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.
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.
The property of an object to take on many different forms. To put this more precisely, a Java object may be accessed using:
A reference with the same type as the object A reference that is a superclass of the object A reference that defines an interface the object implements or inherits
Faisal Ahmad wrote:1. The Java Programming Language book:
What is polymorphic in Java - the reference variable or the object?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.
Carey Brown wrote:Reference.
Enthuware - Best Mock Exams and Questions for Oracle Java Certifications
Quality Guaranteed - Pass or Full Refund!
In programming language theory and type theory, polymorphism is the use of a single symbol to represent multiple different types. -- Luca Cardelli et. al.
In object-oriented programming, polymorphism is the provision of a single interface to entities of different types. -- Bjarne Stroustrup
So polymorphism is the ability (in programming) to present the same interface for differing underlying forms (data types).
Faisal Ahmad wrote:I am studying various resources to understand how Java implements polymorphism, and what exactly are polymorphic in Java.
I wouldn't say either of them have "multiple forms". But like somebody said earlier, we are in the philosophy zone here so I expect "polymorphic" could be made to mean many things.Faisal Ahmad wrote:So far it seems - both reference variables and objects are polymorphic.
them good ole boys were drinking whiskey and rye singin' this'll be the day that I die. Drink tiny ad.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|