title: Avoiding overwriting objects in ArrayList
body: <p>Stackers. I've been searching the site for my question, but didn't find what I was looking for. I'm stuck with this code:</p>
  
  <pre><code>public class Users{
  ArrayList&lt;ValidateUser&gt; personer = new ArrayList&lt;ValidateUser&gt;();
  ValidateUser newUser = new ValidateUser();
      newUser.setUser("administrator");
      newUser.setPass("asdf123");
      newUser.setBalance(0.8);
      newUser.setType("admin");
      personer.add(newUser);
  </code></pre>
  
  <p>Got a nice array-list going on, but if i add more "newUsers" to the ArrayList, they seem to overwrite each other. I don't want to make a newUser1, newUser2 object, since later in my program, I have to be able to add new users, directly from the program.</p>
  
  <p>How to achieve this?</p>
  
  <p>ValidateUser:</p>
  
  <pre><code>public class ValidateUser {
  
  private String username;
  private String password;
  private double balance;
  private String role;
  
  
  public void setUser(String user) {
      username = user;
  }
  public void setPass(String pass) {
      password = pass;
  }
  public void setBalance(double rating) {
      balance = rating;
  }
  public void setType(String type) {
      role = type;
  }
  
  public String getUsername() {
      return username;
  }
  public String getPassword() {
      return password;
  }
  public double getBalance() {
      return balance;
  }
  public String getRole() {
      return role;
  }
  </code></pre>
  
  <p>}</p>