What is the output of the following program?
public class Main { public static void main(String[] args) { new S2();/*from www . j a v a2 s. c o m*/ } Main() { System.out.print("S1"); } } class S2 extends Main { S2() { System.out.print("S2"); } }
C
The superclass (S1) constructor is invoked before the subclass (S2) constructor.