title: How to print the output of an accessor of every instance of a class?
body: <p>How would you go about creating a class like this:</p>
  <pre><code>public class tmUser {
      
      private String Username;
      private int wHours;
      static int numUsers;
      
      
      public tmUser(){
          Username = &quot;&quot;;
          wHours = 0;
      }
      
      public tmUser(String U, int H){
          Username = U;
          wHours = H;
      }
      
      public void setUsername(String U){
          Username = U;
      }
      
      public void setwHours(int H){
          wHours = H;
      }
      
      public String getUsername(){
          return Username;
      }
      
      public int getwHours(){
          return wHours;
      }
      
      public static void initnumUsers(){
          numUsers = 0;
      }
      
      public static int getnumUsers(){
          return numUsers;
      }
  }
  </code></pre>
  <p>and then printing all of <code>tmUser</code> instances <code>Username</code> variable? in maybe a for each loop? I'm hoping for something like:</p>
  <pre><code>for each(tmUser){
      System.out.println(Username);
  }
  </code></pre>
  <p>This is for a menu in a program which displays all created users usernames.</p>