How to implement polymorphism in JAVA.

Explain how to implement polymorphism in Java.

Capacity of a method to do different things based on the object that it is acting upon is called as polymorphism. Poly means multiple and morph means change which means a method that provides multiple outputs with different input is said to follow polymorphism principle.

Types of polymorphism
- Polymorphism through overloading
- Polymorphism through inheritance or interface

How can you achieve Multiple Inheritance in Java?

The feature of multiple inheritance in java is eliminated. To inherit a class is to be extended by another class to reuse the class elements and extend itself. A class can implement multiple interfaces, in which all the methods of interfaces must be overridden. Where as in inheritance concept, all the methods, if needed, can be invoked directly and need not be overridden. This is the reason why java eliminates the multiple inheritance feature. Of course, the static final members can be reused.
Java class loaders: What are class loaders?
Java class loaders - The class loader describes the behavior of converting a named class into the bits responsible for implementing that class...
Difference between static and dynamic class loading.
Java static and dynamic class - Dynamic class loading is achieved through Run time type identification. Also called as reflection...
Java Comparator Interface: What is the purpose of Comparator Interface?
Java Comparator Interface - Comparators can be used to control the order of certain data structures and collection of objets too...
Post your comment