Home >Java >javaTutorial >What is polymorphism in java
#What is the polymorphic implementation mechanism? Many people don't know what polymorphism is in Java? This article will explain to you what polymorphism is in Java?
What is polymorphism in java?
Java polymorphism means that the same behavior has many representation forms. We know that triangle is a form and quadrilateral is also a form. Polymorphism here is actually a port. The emergence of polymorphism is actually the right The embodiment of various port forms.
What are the advantages of java polymorphism?
Java has many advantages. First of all, it has many interfaces, has a certain degree of flexibility and simplification, and can eliminate the coupling relationship between types. It is replaceable and has good program scalability.
#What are the three conditions for the existence of polymorphism?
First of all, there must be inheritance, secondly there must be overriding, and thirdly, the parent class references the child class object. When we use polymorphism to call a method, we must first check the parent class Has this method been used? If it does not appear, it means a compilation error. If it does, it means that the subclass method can be called.
The above is a complete introduction to what polymorphism is in java. If you want to know more about java tutorial, please pay attention to the php Chinese website.
The above is the detailed content of What is polymorphism in java. For more information, please follow other related articles on the PHP Chinese website!