Which of the following statements in the given code are true?

class A { A(int i) {} }  // 1
class B extends A {}   // 2
Explanation
The compiler will create a default constructor for the class B, which to create an object will try to call a nonexistent constructor without parameters of class A. As a result, it will generate a compiler error in line 2.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes