title: Java, Generating a dynamic object name
body: <p>I was trying to generate a dynamic object names that will change everytime an object is created. Something like:</p>
  
  <p>first object name would be like <code>"userName"</code> and the following would be like <code>"userName1"</code>.</p>
  
  <p>I'm new to java, and I tried to initialize <code>int count=0</code> and <code>count++</code> to do it, but the <code>User</code> class doesn't seem to allow me to do that like <code>userName+count</code>. Therefore, is there anyway i could possible go about doing it?</p>
  
  <p>I have search through all the similar thread about dynamic object name, but it doesn't seems to work out for my case. </p>
  
  <p><strong>EDIT</strong></p>
  
  <p>So i have this app built up, that allow user to create account.
  And, now i encounter this problem where whenever i tried to create new account, </p>
  
  <p>Firebase clear away all my previous data that i have inserted, and replace it with the current inserted data.</p>
  
  <p>Here's my code:</p>
  
  <p>Main.java</p>
  
  <pre><code>name = (EditText) findViewById(R.id.edit_rName);
  email = (EditText) findViewById(R.id.edit_rEmail);
  password = (EditText) findViewById(R.id.edit_rPassword);
  
  Button btnSubmit = (Button) findViewById(R.id.btn_rSubmit);
      btnSubmit.setOnClickListener(new View.OnClickListener() {
          public void onClick(View v) {
  
  Firebase f = new Firebase("https://xxx.firebaseio.com/");
  
          Firebase usersRef = f.child("users");
          Map&lt;String, User&gt; users = new HashMap&lt;String, User&gt;();
  
          users.put(name.getText().toString(), new User(name.getText().toString(), password
                  .getText().toString(), email.getText().toString()));
  
          usersRef.setValue(users);
      }
      });
  </code></pre>
  
  <p>User.java</p>
  
  <pre><code>public class User {
      private String fullName;
      private String password;
      private String email;
  
      public User(String fullName, String password,String email) {
          this.fullName = fullName;
          this.password = password;
          this.email = email;
      }
  
      public String getPassword() {
          return password;
      }
  
      public String getFullName() {
          return fullName;
      }
  }
  </code></pre>