Tuesday, 17 November 2015

Difference between overloading and overriding


S.No
Overloaded Method
Overridden Method
1
Method name must be same but arguments must be different
Method name and arguments must be same
2
Return type need not be same
Return type must be same until 1.4 version.Co-variant return types are allowed from 1.5
3
No rule for access specifier
Decreasing access specifier is not allowed
4
No rule for exceptions
Checked exception should not increase. There is no rule for unchecked exception

No comments:

Post a Comment