Given:
What is the result?
Given:
What is the result?
When a new instance of class C is created, the constructor of class C is called first. But before any code in the constructor of class C is executed, the constructor of its superclass (class B) is called due to the implicit call to super(). This process continues up the inheritance chain, resulting in the constructor of class A being called first, followed by the constructor of class B, and finally, the constructor of class C. Hence, the output is 'A B C'.
the super method is called by default : first : constructor A is called. second : constructor B . Finally constructor C.
Answer is C
Correct answer is C
The correct answer is C "A B C"
The correct answer is C class A { public A() { System.out.println("A "); } } class B extends A { public B() { System.out.println("B "); } } class C extends B { public C() { System.out.println("C "); } public static void main(String[] args) { C c = new C(); } }
Answer is C compiler add super() as first statement in constructor . hence super class constructor gets called and super class initialized before child class
super() added by JVM -> C is the correct one.
by default compiler puts super() at first line inside any constructor. It calls it's super class constructor first. So correct Answer is ABC
C is correct
all constructors call empty super constructor by default, before executing their own code
correct, implecit super() method execution before each system.out.println of each constructor