Skip to content

Commit 09fb3a5

Browse files
Create exercise.java
1 parent 9808f48 commit 09fb3a5

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

Diff for: exercise.java

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
2+
class A
3+
{
4+
void display1()
5+
{
6+
System.out.println("A's display1");
7+
}
8+
void display2()
9+
{
10+
System.out.println("A's display2");
11+
}
12+
void display3()
13+
{
14+
System.out.println("A's display 3");
15+
}
16+
}
17+
18+
class B extends A
19+
{
20+
void display1()
21+
{
22+
System.out.println("B 's display1");
23+
}
24+
void display4()
25+
{
26+
System.out.println("B 's display4 ");
27+
}
28+
29+
30+
}
31+
class C extends B
32+
{
33+
void display3()
34+
{
35+
System.out.println("c 's display 3");
36+
}
37+
}
38+
public class Main
39+
{
40+
public static void main(String[] args)
41+
{
42+
A a=new A();
43+
a.display1();
44+
B b=new B();
45+
b.display1();
46+
B c=new C();
47+
c.display3();
48+
}
49+
}

0 commit comments

Comments
 (0)