overloading and overriding
What is the difference between method overloading and method overriding in Java?
Differences between method overloading and overriding are:
- Method overloading is static polymorphism. Method overriding is runtime polymorphism.
- Method overloading occurs within the same class. Method overriding happens in two classes with hierarchy relationship.
- Parameters must be different in method overloading. Parameters must be same in method overriding.
- Method overloading is a compile time concept. Method overriding is a runtime concept.