Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void incrementValue(int x) {
- x = x +1;
- }
- //What ever variable is passed into the function will NOT be changed
- //e.g. we pass variable y = 1 -> function call -> result: y=l
- public static void incrementValue(int[] arr) {
- for (int i = 0; i < arr.length; i++) {
- arr[i]+=1;
- }
- }
- //What ever variable is passed into the function WILL be changed
- //e.g. we pass variable int[] y = int{1,2} -> function call -> result: y = int{2,3}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement