Given 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) method1 on Line 4
B) method1 on Line 9
C) method1 on Line 14
D) This is an error and will cause the program to crash.
Correct Answer:
Verified
Q37: A subclass may call an overridden superclass
Q38: If a class contains an abstract method
Q39: Which of the following is true about
Q40: All methods specified by an interface are
Q41: In the following statement, which is the
Q43: A class becomes abstract when you place
Q44: In the following code, which line in
Q45: In the following code, what is missing
Q46: Protected class members can be denoted in
Q47: Which of the following statements declares Salaried
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