We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents ced9b07 + 63fc7ba commit ef4e1f8Copy full SHA for ef4e1f8
simpleSingleInheritance.java
@@ -0,0 +1,37 @@
1
+class Point2D
2
+{
3
+ int x;
4
+ int y;
5
+ void display()
6
+ {
7
+ System.out.println("x="+x+"y="+y);
8
+ }
9
+}
10
+class Point2D extends Point3D
11
12
+ int z;
13
14
15
+ System.out.println("x="+x+"y="+y+"z="+z);
16
17
18
+class simpleSingleInheritance
19
20
+ public static void main(String args[])
21
22
+ Point2D P1 = new P1();
23
+ Point3D P2 = new P2();
24
+ P1.x = 10;
25
+ P1.y = 20;
26
+ System.out.println("Point2D P1 is" + P1.display());
27
+ // initializing point3d
28
+ P2.x = 5;
29
+ P2.y = 6;
30
+ P3.z = 15;
31
+ System.out.println("Point3D P2 is" + P2.display());
32
+
33
34
35
36
37
0 commit comments