There are two classes: an abstract Person and Employee class. The Employee class extends Person class. The Person class has two methods: getName() and setName(String) The Employee class has two Methods: getEmpID() and setEmpID(int)
As per the above code, the "username" reference is of type Person and refer to an Employee object.
so using the "username" reference, we can call only the methods from Person class because while compiling, JAVA looks at the reference type.
But in the above code, I have called the classes from the Employee class using the Person reference and it works. see the following code