GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Java-Work/Question29.java at master · Animesh-Ghosh/Java-Work

Expand file tree

/

Question29.java

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
45 lines (40 loc) · 875 Bytes
/

Question29.java

Copy path

File metadata and controls

45 lines (40 loc) · 875 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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.