Friday, October 14, 2016

rules for overriding


Rule #1: Only inherited methods can be overridden.

Rule #2: Final and static methods cannot be overridden.

Rule #3: The overriding method must have same argument list

Rule #4: The overriding method must have same return type (or subtype).

Rule #5: The overriding method must not have more restrictive access modifier.

Rule #6: The overriding method must not throw new or broader checked exceptions.

Rule #7: Use the super keyword to invoke the overridden method from a subclass

Rule #8: Constructors cannot be overridden.

Rule #10: A static method in a subclass may hide another static one in a superclass, and that’s called hiding.

Rule #11: The synchronized modifier has no effect on the rules of overriding.

Rule #12: The strictfp modifier has no effect on the rules of overriding.

No comments:

Post a Comment

உப்பு மாங்காய்

சுருக்குப்பை கிழவி. சுருக்கங்கள் சூழ் கிழவி. பார்க்கும் போதெல்லாம் கூடையுடனே குடியிருப்பாள். கூடை நிறைய குட்டி குட்டி மாங்காய்கள். வெட்டிக்க...