-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample_6_3.java
More file actions
24 lines (22 loc) · 775 Bytes
/
Example_6_3.java
File metadata and controls
24 lines (22 loc) · 775 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
package unit_06.Examples.Example_03;
public class Example_6_3 {
public static void main(String[] args) {
int[] nums = {2, 4, 6, 8};
System.out.println("Before Calling Method");
for (int i = 0; i < nums.length; i++) {
System.out.print(nums[i] + "\t");
}
System.out.println();
increment(nums[1], nums[3]);
System.out.println("After Calling Method");
for (int i = 0; i < nums.length; i++) {
System.out.print(nums[i] + "\t");
}
}
private static void increment(int a, int b) {
System.out.println("1 and 3 in method: before change: " + a + " " + b);
a++;
b++;
System.out.println("1 and 3 in method: after change: " + a + " " + b);
}
}