-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFunAddOverload.java
More file actions
57 lines (42 loc) · 929 Bytes
/
FunAddOverload.java
File metadata and controls
57 lines (42 loc) · 929 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
55
56
57
class Helper
{ int a ;
int b;
int c;
int d;
int temp;
int add(int a, int b)
{
this.a=a; this.b=b;
temp=this.a+this.b;
return temp;
}
float add(int a, int b, int c)
{
this.a=a; this.b=b; this.c=c;
temp=this.a+this.b+this.c;
return temp;
}
int add(int a, int b, int c, int d)
{
this.a=a; this.b=b; this.c=c;this.d=d;
temp=this.a+this.b+this.c+this.d;
return temp;
}
void displaySum()
{
System.out.println("sum=="+temp);
}
}
public class FunAddOverload {
public static void main(String[] args)
{
Helper h=new Helper();
float sum;
sum=h.add(1,3);
System.out.println(sum);
sum=h.add(1,3,5);
System.out.println(sum);
sum=h.add(1, 2, 3, 4);
System.out.println(sum);
}
}