Abstract Keyword

6. Program

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

abstract class H { abstract void test1(); abstract void test2(); abstract void test3(); } class I extends H { void test1() { System.out.println("From test1"); } void test2() { System.out.println("From test1"); } void test3() { System.out.println("From test3"); } public static void main(String[] args) { // H h1 = new H(); I obj1 = new I(); obj1.test1(); obj1.test2(); obj1.test3(); System.out.println("Done"); } }

7. Program

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

abstract class J { abstract void test1(); abstract void test2(); void test3() { System.out.println("From test3"); } } abstract class K extends J { void test1() { System.out.println("From test1"); } } // Imp Program class L extends K { void test2() { System.out.println("From test2"); } public static void main (String[] args) { L l1 = new L(); l1.test1(); l1.test2(); l1.test3(); System.out.println("Done"); } }

8. Program

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

abstract class K { abstract void method1(); abstract void method2(); abstract void method3(); abstract void method4(); } abstract class L extends K { void method1() { System.out.println("From method1"); } abstract void method5(); } class M extends L { void method2() { System.out.println("From method2"); } void method3() { System.out.println("From method3"); } void method4() { System.out.println("From method4"); } void method5() { System.out.println("From method5"); } public static void main (String[] args) { M m1 = new M(); m1.method1(); m1.method2(); m1.method3(); m1.method4(); m1.method5(); System.out.println("Done"); } }

Page....