title: Java class variable that tracks number of objects instantiated
body: <p>I have this class, Student, with the variable StudentID:<br></p>
  
  <pre><code>public class Student extends Person{
    int studentID = 0;
    int level;
  
    public Student(){
  
    }
  
    public Student(String fName, String lName, int gLevel){
      super(fName, lName);
      if(gLevel &gt;= 0 &amp;&amp; gLevel &lt;= 12){
        level = gLevel;
      }
      studentID++;
    }
    public int getLevel(){
      return level;
    }
    public String toString(){
      String toReturn;
      toReturn = super.toString() + "\n   Grade Level: " + level + "\n   ID #: " + studentID;
      return toReturn;
    }
  }
  </code></pre>
  
  <p>I want the variable StudentID to keep assign each Student created a new ID number. Each ID number should be one more than the last ID number created, and so equal to the total number of objects that have been created. Right now each object is assigned the ID number of 1.</p>