
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Runtime Polymorphism and Dynamic Method Overloading
Polymorphism is the ability of an object to take on many forms. The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object. Method overriding by a subclass is termed as runtime polymorphism. JVM determines the method to be executed at runtime instead of compile time.
example
class SuperClass { SuperClass get(){ System.out.println("SuperClass"); return this; } } public class Tester extends SuperClass { Tester get(){ System.out.println("SubClass"); return this; } public static void main(String[] args) { SuperClass tester = new Tester(); tester.get(); } }
Output
SubClass
Advertisements