I have this class, Student, with the variable StudentID:
public class Student extends Person{ int studentID = 0; int level; public Student(){ }
Add a static counter and initialize studentID with it, incrementing it in the process :
counter
studentID
public class Student extends Person{ static counter = 1; int studentID = counter++; ...