Polymorphism
polymorphism
polymorphism is the provision of a single interface to entities of different types or the use of a single symbol to represent multiple different types.
downcasting
type cast to the type of a descendant class; may cause runtime errors. Downcasting is allowed when there is a possibility that it succeeds at run time:
rules for polymorphic method calls
In Java, static polymorphism is achieved through method overloading. Method overloading means there are several methods present in a class having the same name but different types/order/number of parameters. Runtime polymorphisms (overriding of functions ). Compile time polymorphisms (overloading of functions )
dynamic or late binding
Late binding, dynamic binding, or dynamic linkage is a computer programming mechanism in which the method being called upon an object or the function being called with arguments is looked up by name at runtime.
method overloading
Method Overloading is a feature that allows a class to have more than one method having the same name, if their argument lists are different. It is similar to constructor overloading in Java, that allows a class to have more than one constructor having different argument lists.
Method Overriding
Method overriding is one of the way by which java achieve Run Time Polymorphism.
static or early binding
Static vs Dynamic Binding in Java. Static Binding: The binding which can be resolved at compile time by compiler is known as static or early binding. Binding of all the static, private and final methods is done at compile-time .
ClassCastException
This exception is used to indicate that the application's code has attempted to cast a specific object to a class of which it is not an instance. For example, an Integer object cannot be casted to a String object.