-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMethod.java
50 lines (33 loc) · 978 Bytes
/
Method.java
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
import java.util.*;
public class Method{
int max(int x, int y) {
if(x>y)
return x;
else
return y;
}
static void inc(int x){
x++;
System.out.println(x);
}
//Method Overloading
static int bignum(int a,int b)
{
return a>b?a:b;
}
static int bignum(int a,int b,int c)
{
if(a>b && a>c) return a;
else if(b>c) return b;
return c;
}
public static void main(String[] args){
//Call Method without Static through Object
int a=52,b=96;
Method maxi = new Method();
System.out.println(maxi.max(a,b));
//Method Overloading
System.out.println( bignum(10,5));
System.out.println(bignum(10,15,5));
}
}