I have a question regarding creating an array of variables; if I create an array of variables of the integer type, and I change the value of those variables outside of the array will the values inside the array also get update? I have tried this out in eclipse and it doesn't seem to work (see code below)
int num1 = 1;
int num2 = 2;
int num3 = 3;
int [] nums = {num1, num2, num3};
num1++;
System.out.println(num1);
System.out.println(nums[0]);
What I am hoping for is for the two outputs (num1 and nums[0]) to be the same, but what I am experiencing so far is that nums[0] stays the same and doesn't get updated, any tips on how to get this value updated (without needing to go in and update it as well) is most appreciated
nums[0]++;to increment a number within the array.