Look at the following code: Line 1 public class ClassA
Line 2 {
Line 3 public ClassA() {}
Line 4 public void method1(int a) {}
Line 5 }
Line 6 public class ClassB extends ClassA
Line 7 {
Line 8 public ClassB() {}
Line 9 public void method1() {}
Line 10 }
Line 11 public class ClassC extends ClassB
Line 12 {
Line 13 public ClassC() {}
Line 14 public void method1() {}
Line 15 }
Which method1 will be executed when the following statements are executed?
ClassA item1 = new ClassB() ;
Item1.method1() ;
A) Line 4
B) Line 9
C) Line 14
D) This is an error and will cause the program to crash.
Correct Answer:
Verified
Q15: It is not possible for a superclass
Q50: In a class hierarchy:
A) the more general
Q51: Like a family tree, a _ shows
Q52: Private members of the superclass cannot be
Q53: An anonymous inner class must:
A) implement an
Q54: What is required for an interface method
Q57: Which of the following is an example
Q58: Which of the following statements correctly specifies
Q59: Look at the following code: Line 1
Q60: Which of the following is TRUE about
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents