title: Change value of a static variable in a single instance (Java)
body: <p>I have only just begun learning Java. Say if you create the following class:</p>
  
  <pre><code>class FamilyMember {
      static String lastName = "Doe";
      String name;
      int age;
  }
  </code></pre>
  
  <p>Now you create an instance for a daughter, and set her name to, say, Ann, etc. If she gets married or decides to change her last name, how would you go about changing only her instance's value of lastName and not the entire class? </p>
  
  <p>At first I tried creating two instances:</p>
  
  <pre><code>FamilyMember john = new FamilyMember();
  FamilyMember ann = new FamilyMember();
  ann.lastName = "Stewart";
  </code></pre>
  
  <p>But that changed the entire class. I tried creating a method in the FamilyMember class that would set a new lastName:</p>
  
  <pre><code>void changeLastName(String newName) {
      lastName = newName;
  }
  </code></pre>
  
  <p>Even tried adding 'static' before void. But all those simply kept changing the value for the entire class. I found similar questions on the forum but none of them addressing this particular issue. </p>