title: How do you set one array's values to another array's values in Java?
body: <p>Lets say you had two arrays:</p>
  
  <pre><code>    int[] a = {2, 3, 4};
      int[] b = {4, 5, 6};
  </code></pre>
  
  <p>How would you set array a to array b and keep them different different objects? Like I thought of doing this:</p>
  
  <pre><code>    a = b; 
  </code></pre>
  
  <p>But that doesn't work since it just makes "a" reference array b. So, is the only way to set two arrays equal, while keeping them separate objects, to loop through every element of one array and set it to the other?</p>
  
  <p>And what about ArrayList? How would you set one ArrayList equal to another when you have objects in them?</p>