What does the following print? (Update: Sub extends Super)
public class Super {
static { System.out.println("super static"); }
{ System.out.println("super instance"); }
Super() { System.out.println("super constructor"); }
private static class Sub extends Super {
static { System.out.println("sub static"); }
{ System.out.println("sub instance"); }
Sub() { System.out.println("sub constructor"); }
}
public static void main(String[] args) {
System.out.println("start");
new Sub() {{System.out.println("anonymous instance"); }};
}
}
1 comment:
Hello mate great blog.
Post a Comment