0

Why this print New A New B if in the main only is instancing obj?

class A { public A() { System.out.println("New A"); } } class B extends A { public B() { System.out.println("New B"); } } class Program { public static void main(String[ ] args) { B obj = new B(); } }

5th Jul 2017, 10:22 PM
Fomnlinx Chan
Fomnlinx Chan - avatar
1 Answer