-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalculation.java
More file actions
61 lines (38 loc) · 1.06 KB
/
calculation.java
File metadata and controls
61 lines (38 loc) · 1.06 KB
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
58
59
60
61
package com.Day5;
public class calculation {
int x=240;
int y=120;
////using no return and no parameter method------------------------------------------------->
// void sum(){
//
// System.out.println(x+y);
//
// }
// case 2.no taking parameter but return some ouput---------------------------------->
// int sub()
// {
// return(x-y);
// }
// case3: parameter but no output----------------------------------------->
// void sum(int a ,int b)
// {
// x=a;
// y=b;
// System.out.println(x+y);
// }
// case 4: Paramter and return output--------------------------------------->
int sum(int a ,int b){
x=a;
y=b;
return(x+y);
}
public static void main(String args[]){
calculation c1=new calculation();
// c1.sum();
// int result=c1.sub();
// System.out.println(result);
// c1.sum(111,120);
int result=c1.sum(1,3);
System.out.println(result);
}
}