title: Updating elements in an ArrayList in Java?
body: <p>I have the following class:</p>
  
  <pre><code>public class Profile{
      String name, age, location;
  }
  </code></pre>
  
  <p>Say that I then have the following code:</p>
  
  <pre><code>ArrayList&lt;Profile&gt; profiles = somePopulatedArrayList;
  Profile profile = profiles.get(1);
  profile.name = "New name here";
  </code></pre>
  
  <p>My question is when I have the above, is the <code>.name</code> of the object in the ArrayList getting updated, or am I creating a completely new object here and only changing the <code>.name</code> of that object while the <code>Profile</code> object stored in the ArrayList still has the old name? </p>
  
  <p>I'm trying to edit properties of objects in the ArrayList and I'm wondering if the above approach is correct or not?</p>