Polymorphism in Java / Interview questions on Polymorphism

 


Polymorphism  in Java (Rules)

  • Ø  Polymorphism has two types

    o   Compile time polymorphism/ Static Binding/ Early binding.  Ex:- Method Overloading.

    o   Run Time Polymorphism/ Dynamic binding/ Late binding. Ex:- Method Overriding.

    Ø  Overloading can be done via 3- ways in java

    o   Method Overloading

    o   Operator Overloading

    o   Constructor Overloading

    Ø  In Java Operator are overloaded by default.

    Ø  we can have more than one main function in a single java file.

    Ø  In method overloading return type does not have any impact on function since while calling the function we don’t specify the return type..

Post a Comment