Inner Classes

29. Program

//Find what it gives Compiletion Error / Compiletion Successfully / Output ?

interface C { void test1(); void test2(); } class Manager9 { public static void main(String[] args) { C c1 = new C() { public void test1() { System.out.println("test 1"); } public void test2() { System.out.println("test 2"); } }; c1.test1(); c1.test2(); System.out.println("Done"); } }

30. Program

//Find what it gives Compiletion Error / Compiletion Successfully / Output ?

abstract class B { abstract void test1(); void test2() { System.out.println("B test-2"); } } interface C { void test1(); void test2(); } class Manager10 { static void method1(B b1) { b1.test1(); b1.test2(); } static void method2(C c1) { c1.test1(); c1.test2(); } public static void main(String[] args) { System.out.println("Done"); } }

31. Program

//Find what it gives Compiletion Error / Compiletion Successfully / Output ?

abstract class B { abstract void test1(); void test2() { System.out.println("B test-2"); } } interface C { void test1(); void test2(); } class Manager11 { static void method1(B b1) { b1.test1(); b1.test2(); } static void method2(C c1) { c1.test1(); c1.test2(); } public static void main(String[] args) { B b1 = null; method1(b1); C c1 = null; method2(c1); System.out.println("Done"); } }

32. Program

//Find what it gives Compiletion Error / Compiletion Successfully / Output ?

class D { D() { System.out.println("D()"); } D(int i) { System.out.println("D(int)"); } { System.out.println("D-IIB"); } } class Manager15 { public static void main(String[] args) { D d1 = new D() { { System.out.println("first IIB"); } }; System.out.println("......."); D d2 = new D(10) { { System.out.println("second IIB"); } }; } }

Page....