What is the output of the following code.
abstract class Foo { static { System.out.println("abstract static"); } { System.out.println("abstract instance"); } } abstract class Bar { abstract void hello(); } public class Main extends Foo { public static void main(String[] args) { System.out.println("main"); Main a = new Main(); Bar b = new Bar() { @Override void hello() { System.out.println(1); } }; b.hello(); } }
abstract static main abstract instance 1
abstract class Foo { static {/*w w w .j av a2 s .co m*/ System.out.println("abstract static"); } { System.out.println("abstract instance"); } } abstract class Bar { abstract void hello(); } public class Main extends Foo { public static void main(String[] args) { System.out.println("main"); Main a = new Main(); Bar b = new Bar() { @Override void hello() { System.out.println(1); } }; b.hello(); } }