I am confused after having read different explanations of polymorphism in Java.
- The Java Programming Language book:
polymorphism, meaning that an object of a given class can have multiple forms, either as
its own class or as any class it extends. The new class is a subclass or extended class of the class it extends; the class that is extended is its superclass.
- Sun Educational Services Java course book:
- Polymorphism is the ability to have many different forms; for example, the Manager class has access to methods from Employee class.
- An object has only one form.
- A reference variable can refer to objects of different forms.
What exactly is polymorphic – the reference variable or the object?