Computers and Technology
Computers and Technology, 13.12.2019 20:31, codyclay

Answer the following questions as briefly (but completely) as possible: 1. what is the printout of running the class c (via the command "java c") in the code below (saved in c. java)? (and, is that what you expected? ) 1: class a { 2: public a () { 3: system. out. println( "a's no-arg constructor is invoked" ); 4: } 5: } 6: 7: class b extends a { 8: } 9: 10: public class c {11: public static void main ( string [] args ) {12: b b = new b(); 13: }14: }2. what problem do you expect to see if compiling the program below? what was the error(s), if any, actually produced? 1: class a { 2: public a ( int x ) { 3: } 4: } 5: 6: class b extends a { 7: public b () { 8: } 9: }10: 11: public class c {12: public static void main ( string [] args ) {13: b b = new b(); 14: }15: }3 .which of the follow statements are true? which are false? explain why. a. a subclass is a subset of a superclass. b. when invoking a constructor from a subcass, its superclass's no-arg constructor is always invoked. c. you can override a private method defined in a superclass. d. you can override a static method defined in a superclass. 4. what is the benefit of using the @override annotation? 5. a. show the output of the following program: 1: public class test { 2: public static void main ( string [] args ) { 3: a a = new a( 3 ); 4: } 5: } 6: 7: class a extends b { 8: public a ( int t ) { 9: system. out. println( "a's constructor is invoked" ); 10: } 11: } 12: 13: class b { 14: public b () { 15: system. out. println( "b's constructor is invoked" ); 16: } 17: } b. is the no-arg constructor of object invoked when new a(3) is invoked? 6. indicate true or false for the follow statements: a. you can always successfully cast an instance of a subclass to a superclass. b. you can always successfully cast an instance of a superclass to a subclass. 7. what's wrong with the following code? 1: public class test { 2: public static void main ( string [] args ) { 3: object fruit = new fruit(); 4: object apple = (apple) fruit; 5: } 6: } 7: 8: class apple extends fruit { 9: } 10: 11: class fruit { 12: }8. when overriding the equals method, a common mistake is mistyping its signature in the subclass. for example, the equals method is incorrectly written as equals (circle circle) as shown in (a) below. it should be written as equals(object circle), as shown in (b) below. show the output of running class test using the circle class first from (a), and then from (b). explain the output.1: public class test {2: public static void main ( string [] args ) {3: object circle1 = new circle(); 4: object circle2 = new circle(); 5: system. out. println( circle1.equals( circle2 ) ); 6: }7: }a. 1: class circle { 2: double radius; 3: public boolean equals ( circle circle ) { 4: return this. radius == circle. radius; 5: } 6: }b. 1: class circle { 2: double radius; 3: public boolean equals ( object circle ) { 4: return this. radius == ((circle) circle).radius; 5: } 6: } next, try adding the "@override" annotation to the equals method in (a), and then try compiling. repeat with (b). what are the results, and are they as you expected? 9. how would you prevent a class from being extended? how would you prevent a method from being overridden? 10 . which of the following classes define legal abstract classes a.1: class a { 2: abstract void unfinished ( ) { 3: } 4: }b.1: public class abstract a { 2: abstract void unfinished ( ) { 3: } 4: }c. 1: class a { 2: abstract void unfinished ( ) ; 3: }d. 1: abstract class a { 2: protected void unfinished ( ) ; 3: }e. 1: abstract class a { 2: abstract void unfinished ( ) ; 3: }f. 1: class a { 2: abstract int unfinished ( ) ; 3: }11. suppose a is an interface. can you create an instance using "new a()"? 12. which of the following (if any) is a correct interface declaration? (assume i1 and i2 are correctly defined elsewhere.)a. 1: interface a { 2: void print () { 3: }; 4: }b. 1: abstract interface a extends i1, i2 { 2: abstract void print () { 3: }; 4: }c. 1: abstract interface a { 2: print () ; 3: }d. 1: interface a { 2: void print () ; 3: }

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 10:20, vuqepete4528
Shown below is the start of a coding region within the fist exon of a gene. 5'--3' 3'--5' how many cas9 pam sequences are present?
Answers: 1
image
Computers and Technology, 23.06.2019 03:00, tay9122
Jason, samantha, ravi, sheila, and ankit are preparing for an upcoming marathon. each day of the week, they run a certain number of miles and write them into a notebook. at the end of the week, they would like to know the number of miles run each day, the total miles for the week, and average miles run each day. write a program to them analyze their data. your program must contain parallel arrays: an array to store the names of the runners and a two-dimensional array of five rows and seven columns to store the number of miles run by each runner each day. furthermore, your program must contain at least the following functions: a function to read and store the runners’ names and the numbers of miles run each day; a function to find the total miles run by each runner and the average number of miles run each day; and a function to output the results. (you may assume that the input data is stored in a file and each line of data is in the following form: runnername milesday1 milesday2 milesday3 milesday4 milesday5 milesday6 milesday7.)
Answers: 3
image
Computers and Technology, 24.06.2019 17:30, mjmckay03
What is the main difference between cloud computing and saas? cloud computing is a platform, and saas is software. cloud computing is software, and saas is a platform. cloud computing is a service, and saas is software. cloud computing is a service, and saas is a platform.
Answers: 1
image
Computers and Technology, 24.06.2019 17:40, xinkyx616
Pseudocode pld #6, pg. 117 start// declarations// number numbertoguess// number myguess; numbertoguess = 92// while myguess ! = numbertoguess// output " guess an integer number between 1 and 100"// input myguess// if (myguess == numbertoguess)// output "you guessed the correct number"// else// output "the number you guessed was incorrect. try again! "// end if// end while// output " for playing the guessing game. have a great day! "// stop
Answers: 3
Do you know the correct answer?
Answer the following questions as briefly (but completely) as possible: 1. what is the printout of r...

Questions in other subjects: