Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  Polymorphism in OOP programming

Polymorphism is the capability of an action or method to do different things based on the object that it is acting upon. This is the third basic principle of object oriented programming. Overloading, overriding and dynamic method binding are three types of polymorphism.Overloaded methods are methods with the same name signature but either a different number of parameters or different types in the parameter list. For example 'spinning' a number may mean increase it, 'spinning' an image may mean rotate it by 90 degrees. By defining a method ...

8,868 0       JAVA OOP POLYMORPHISM OVERLOADING OVERRI


  Java Polymorphism and Overriding Methods

Most Java developers will be familiar with polymorphism – we’ve all seen the example of the Dog and Cat classes inheriting from some abstract Animal class and having their say() methods produce different results. But it’s still worthwhile to look at a few simple examples to reinforce the concepts.First, we define a simple class with one instance method and one static method.public class A{ public String getName() { return "I am A"; } public static String getStaticName() { return "Statically A!"; }}Then we extend that clas...

2,723 0       JAVA POLYMORPHISM DEMO OVERRIDING DYNAMI