computerscience
Saturday, May 28, 2011
Monday, January 24, 2011
difference between method overloading and method overriding
METHOD OVERLOADING | METHOD OVERRIDING |
1.Relationship between methods of same class. | 1.Relationship between superclass . |
2.Different methods share the same name. | 2.Subclass method overrides the superclass method. |
3.Doesnot block inheritance from the superclass | 3.Blocks inheritance from the superclass. |
4.Different method signatures. | 4.Same method signatures. |
5.Can have different declared exceptions. | 5.Should have compatible declared exceptions. |
6.Can have different return types. | 6.Should have matching return types. |
Subscribe to:
Posts (Atom)