-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMethod Overloading
More file actions
54 lines (42 loc) · 791 Bytes
/
Method Overloading
File metadata and controls
54 lines (42 loc) · 791 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
49
50
51
52
53
54
import java.lang.*; //syatem library file
import java.lang.reflect.Array;
import java.io.*; //printstream classes
import java.util.*; //bcz of scanner class
class paras
{
void fn1()
{
System.out.println("fn1");
}
void fn1()
{
System.out.println("fn2");
}
void fn2(int a)
{
System.out.println("fn3");
}
void fn2(float a)
{
System.out.println("fn4");
}
//BY CHANGINF THE RETURN TYPE FN WILL NOT EFFECT
// int fn2(float a)
// {
// /*error reason is bcz fn2 = above fn2
// it dosen't mean of any return value
// */
//
// System.out.println("fn5");
// }
}
public class UdemyClasses
{
public static void main(String args[])
{
paras obj = new paras();
obj.fn2(2.0f);
obj.fn2(2);
obj.fn1();//whose declared first will call
}
}