Multiple choice technology programming languages

consider the following classes. Class A, Class B extends A, Class C extends B. if we instantiate an object, which order the constructor of the above classes get executed?

  1. A,C,B

  2. C,B,A

  3. A,B,C

  4. none of the above

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

In Java inheritance, when a subclass object is instantiated, the constructors are called in order from the top of the hierarchy down. Thus, the constructor for A (superclass) runs first, then B, then C (subclass).