title: Storing values in a for loop?
body: <p>I'm new to Java, and I'm having problems with a math test program I'm creating (no worries; the issue isn't a mathematical calculation). I'm putting an array of doubles that all equal zero through a for loop that'll assign a random number to them. They retain the random number, but then those numbers are reset to zero once it exits the for loop. I thought once I stored the changed number in a loop, it was permanently changed, but is this not the case? Here's the code segment:</p>
  
  <pre><code>        int a = 0;
          int b = 0;
          int c = 0;
          double x = 0;
          Random num = new Random();
          int[] abc = {a, b, c};
          for(int i = 0; i &lt;= (abc.length-1); i++){
              int nums = num.nextInt(10);
              abc[i] = nums;
              System.out.println(abc[i]);
          }
          System.out.println(a + " " + b + " " + c);
  </code></pre>
  
  <p>I put a system.out in and out of the for loop to see what prints. I'm not quite certain why they all become zeros again, or how I'm supposed to properly revalue the elements. Any help is appreciated. Thank you for your time.</p>