We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent aa4095d commit 9f7d36bCopy full SHA for 9f7d36b
31.Methods/Ch7 Methods.pdf
2.08 MB
31.Methods/cwh_31_methods.java
@@ -0,0 +1,32 @@
1
+public class cwh_31_methods {
2
+
3
+ static int logic(int x, int y){
4
+ int z;
5
+ if(x>y){
6
+ z = x+y;
7
+ }
8
+ else {
9
+ z = (x +y) * 5;
10
11
+ x = 566;
12
+ return z;
13
14
15
16
+ public static void main(String[] args) {
17
+ int a = 5;
18
+ int b = 7;
19
+ int c;
20
+ // Method invocation using Object creation
21
+ //cwh_31_methods obj = new cwh_31_methods();
22
+ //c = obj.logic(a, b);
23
+ c = logic(a, b);
24
+ System.out.println(a + " "+ b);
25
+ int a1 = 2;
26
+ int b1 = 1;
27
+ int c1;
28
+ c1 = logic(a1, b1);
29
+ System.out.println(c);
30
+ System.out.println(c1);
31
32
+}
0 commit comments