Look at the following code. Which line will cause a compiler error?
Line 1 public class ClassA
Line 2 {
Line 3 public ClassA() {}
Line 4 public final int method1(int a) {}
Line 5 public double method2(int b) {}
Line 6 }
Line 7 public ClassB extends ClassA
Line 8 {
Line 9 public ClassB() {}
Line 10 public int method1(int b) {}
Line 11 public double method2(double c) {}
Line 12 }
A) 4
B) 5
C) 10
D) 11
Correct Answer:
Verified
Q8: In UML diagrams, inheritance is shown:
A) With
Q9: A protected member of a class may
Q10: If ClassC extends ClassB, which extends ClassA,
Q11: Replacing inadequate superclass methods with more suitable
Q12: When an "is a" relationship exists between
Q15: When a subclass overloads a superclass method:
A)
Q16: What key word can you use to
Q17: Look at the following code and determine
Q18: If ClassA extends ClassB, then:
A) public and
Q55: If a subclass constructor does not explicitly
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