What will be the output of the following code?
class Base {
Base() {
System.out.println("Base Constructor");
}
}
class Derived extends Base {
Derived() {
System.out.println("Derived Constructor");
}
}
public class Main {
public static void main(String[] args) {
Derived obj = new Derived();
}
}
Base Constructor
Derived Constructor
Derived Constructor
Base Constructor
Compilation Error
Runtime Error
This question is part of this quiz :
Java Constructors