WHAT ARE THE RULES (METHOD ACCESS PERMISSION AND EXCEPTION) THAT NEEDS TO BE FOLLOWED, DURING METHOD OVERLOADING AND OVERRIDING ?

Mayank Tripathi

Total Post:807

Points:4035
Posted by  Mayank Tripathi
Java 
 900  View(s)
Ratings:
Rate this:
  1. Mayank Tripathi

    Post:807

    Points:4035
    What are the rules (method access permission and exception) that needs to be followed, during method overloading and overriding ?

    During method Overloading, method name should remain same. But method signature can vary. Components of signature that can vary are:
    1.Number of arguments
    2.Datatype of arguments
    3.Order of arguments

    During method Overriding, make sure that the method is not throwing checked exceptions that are new or higher than those declared by the overridden method.But we can't override Static and Final methods.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!