1) overloading - compiler decides which method should invoked .
overriding - JVM decides which method should invoked.
2) overloading - is called compile time polymorphism.
overriding - is called run time polymorphism.
3) Overloading - Arguments must change.
Overriding - Arguments should not change.
4) overloading - Return type can change.
overriding - Return type should not change.
5) overloading - Can throw new or broader exception.
overriding - should not throw any exception. but can throw runtime exception.
6) overloading - Reference type determine which method invoked during compile time.
overriding - object type decides which method invoked during run time.
No comments:
Post a Comment