Look at the following code. Line 1 public class ClassA
Line 2 {
Line 3 public ClassA() {}
Line 4 public void method1() {}
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 as a result of the following statements?
ClassA item1 = new ClassC() ;
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
Q18: If ClassA extends ClassB, then:
A) public and
Q19: When a method is declared with the
Q20: Which of the following statements declares Salaried
Q21: Look at the following code. The method
Q22: Look at the following code. Which line
Q24: In the following code, what will the
Q25: Look at the following code. What is
Q26: What is wrong with the following code?
Public
Q27: When one object is a specialized version
Q28: In the following statement, which is the
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