GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Java-Work/Question29.java at master · Animesh-Ghosh/Java-Work Expand file tree/ Copy pathQuestion29.javaMore file actions 45 lines (40 loc) · 875 Bytes / Copy pathQuestion29.javaFile metadata and controls45 lines (40 loc) · 875 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 // program to demonstrate single, multi-level and heirarchichal inheritance class A { void outA () { System.out.println ("Super-class A."); } } class B extends A { void outB () { System.out.println ("Sub-class B of super-class A."); } } class C extends B { void outC () { System.out.println ("Sub-class C of super-class B."); } } class D extends A { void outD () { System.out.println ("Sub-class D of super-class A."); } } class Question29 { public static void main(String[] args) { System.out.println ("Single-level inheritance: "); B objB = new B (); objB.outA (); objB.outB (); System.out.println ("Multi-level inheritance: "); C objC = new C (); objC.outA (); objC.outB (); objC.outC (); System.out.println ("Heirarchichal inheritance: "); D objD = new D (); objD.outA (); objD.outD (); objB.outA (); objB.outB (); } } |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |