0

2 instances of employee object has been created. and e1 is set equal to e2 (e1=e2). After this i cant independently setID for objects. They both change together. how can i make changes independently to objects when e1=e2 has been executed.

public static class Employee{

    public int ID;

    public int getID() {
        return ID;
    }

    public int getTimesCalled(){
        return timesCalled;
    }

    public void setID(int employeeID) {
        this.ID = employeeID;
    }

}// End Employee


Employee e1 = new Employee();
Employee e2 = new Employee();
e1.setID(123);
e2.setID(456);
e1 = e2;
Mv2156
  • 27
  • 4

0 Answers0