Java Subclasses last instance overwriting values
<p>I'm a web developer dabbling in Java (again) and I'm having trouble with something.</p>

<p>Basically, I have a superclass Employee with two subclasses that extend it called Management and Programmer. The Employee class contains an array <code>employees</code> that is basically an array of Employee objects.</p>

<p>Here's the important snippets of two of the classes (Employee and Management) and the final main method. I'll explain the output at the bottom.</p>

<pre><code>public class **Employee** {

   private static String firstName;
   protected static int MAXEMPLOYEES = 5;
   protected Employee[] employees = new Employee[MAXEMPLOYEES];
   protected int totEmployees = 0;

   public Employee(String first) {
       setFirstName(first);
   }

   public void setFirstName(String str){
       firstName = str;
   }

   public String getFirstName(){
       return firstName;
   }

    public boolean addEmployee(String fname) {
       boolean added = false;
       if (totEmployees &lt; MAXEMPLOYEES) {
           Employee empl = new Employee(fname);
           employees[totEmployees] = empl;
           added = true;
           totEmployees++;
       }
       return added;
   }

}

public class **Management** extends **Employee** {
    private String title = "Project Manager";

    public Management(String fname, String t){
        super(fname);
        title = t;
    }

    public boolean addManagement(String fname, String t){
        boolean added = false;

        if (totEmployees &lt; MAXEMPLOYEES) {
            employees[totEmployees] = new Management(fname, t);
            added = true;
            totEmployees++;
        }
        return added;
    }
}

-------------------------------------
package employee;

public class EmployeeApplication {

    public static void main(String[] args) {
        Employee[] empl = new Employee[3];
        empl[0] = new Employee("Kyle");
        empl[1] = new Management("Sheree", "Director");

        System.out.println(empl[0].getFirstName());
    }
}
</code></pre>

<p>Now, I expect the system to print out "Kyle", but it prints out "Sheree". Any ideas???</p>
