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.
1 parent 649a1dc commit dc9f94eCopy full SHA for dc9f94e
Methods/MethodOverriding3.java
@@ -0,0 +1,50 @@
1
+class A {
2
+ int i, j;
3
+
4
+ A() {
5
6
+ }
7
8
+ A(int a, int b) {
9
+ i = a;
10
+ j = b;
11
12
13
+ void Showij() {
14
+ System.out.println("A's i=" + i);
15
+ System.out.println("A's j=" + j);
16
17
+}
18
19
+class B extends A {
20
+ int k;
21
22
+ B(int a, int b, int c) {
23
24
25
+ k = c;
26
27
28
29
+ super.Showij();
30
+ System.out.println("B's i=" + i);
31
+ System.out.println("B's j=" + j);
32
33
34
35
+ void Showk() {
36
+ System.out.println("k=" + k);
37
38
39
40
+/**
41
+ * SingleInheritence
42
+ */
43
+class MethodOverriding3 {
44
+ public static void main(String[] args) {
45
+ A obj1 = new B(12, 45, 78);
46
+ obj1.Showij();
47
+ B subobj = new B(5, 10, 15);
48
+ subobj.Showk();
49
50
0 commit comments