- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReturnMethod.java
More file actions
Latest commit
25 lines (23 loc) · 587 Bytes
/
Copy pathReturnMethod.java
File metadata and controls
25 lines (23 loc) · 587 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
publicclassReturnMethod {
publicstaticvoidmain(String[] args) {
varres1 = sum (100,100);
System.out.println(res1);
System.out.println(sum(200,200));
System.out.println(hitung(100, "+" ,100));
System.out.println(hitung(200, "-", 100));
}
staticintsum(intvalue1, intvalue2){
varres = value1 + value2;
returnres;
}
staticinthitung(intvalue1, Stringoperasi, intvalue2){
switch(operasi){
case"+":
returnvalue1 + value2;
case"-":
returnvalue1 - value2;
default:
return0;
}
}
}