forked from Annex5061/java-algorithms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoverloading_java
More file actions
48 lines (35 loc) · 784 Bytes
/
overloading_java
File metadata and controls
48 lines (35 loc) · 784 Bytes
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
46
47
48
class i1
{
void hello(String s)
{
System.out.println(s);
}
}
class j1 extends i1{
void hello(String s)
{
super.hello(s);
System.out.println(s);
}
}
class k1 extends j1{
void hello(String s)
{
super.hello(s);
System.out.println(s);
}
}
public class overload {
public static void main(String[] args)
{
//referance and instace both are same i1
i1 obj1=new i1();
// obj1.hello("vaghela ajitkumar");
//object same just change the instance is j1
//obj1=new j1();
// obj1.hello("vaghela ajitkumar");
//object same just change the instance is k1
obj1=new k1();
obj1.hello("goverment engineering collage rajkot");
}
}