File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com.company;
2
+
3
+ class i1
4
+ {
5
+ void hello(String s)
6
+ {
7
+ System.out.println(s);
8
+ }
9
+ }
10
+
11
+ class j1 extends i1{
12
+ void hello(String s)
13
+ {
14
+ super.hello(s);
15
+ System.out.println(s);
16
+ }
17
+ }
18
+
19
+ class k1 extends j1{
20
+ void hello(String s)
21
+ {
22
+ super.hello(s);
23
+ System.out.println(s);
24
+ }
25
+ }
26
+
27
+ public class overload {
28
+
29
+ public static void main(String[] args)
30
+ {
31
+ //referance and instace both are same i1
32
+
33
+ i1 obj1=new i1();
34
+ // obj1.hello("vaghela ajitkumar");
35
+
36
+ //object same just change the instance is j1
37
+
38
+ //obj1=new j1();
39
+ // obj1.hello("vaghela ajitkumar");
40
+
41
+ //object same just change the instance is k1
42
+
43
+ obj1=new k1();
44
+ obj1.hello("goverment engineering collage rajkot");
45
+
46
+
47
+ }
48
+ }
You can’t perform that action at this time.
0 commit comments