What is the output of running class C? class A { public A() { System.out.println( "The default constructor of A is invoked"); } } class B extends A { public B() { System.out.println( "The default constructor of B is invoked"); } } public class C { public static void main(String[] args) { B b = new B(); } }

What is the output of running class C?
class A {
  public A() {
    System.out.println(
      "The default constructor of A is invoked");
  }
}
class B extends A {
  public B() {
    System.out.println(
      "The default constructor of B is invoked");
  }
}
public class C  {
  public static void main(String[] args) {
    B b = new B();
  }
}

A. Nothing displayed
B. "The default constructor of B is invoked"
C. "The default constructor of A is invoked""The default constructor of B is invoked"
D. "The default constructor of B is invoked""The default constructor of A is invoked"
E. "The default constructor of A is invoked"

The correct answer is C


Java

Learn More Multiple Choice Question :