What are the Rules of Method Overloading and Method Overriding in Java ?

When we want to overload a method, we need to make sure that the method name remains same. But method signature can vary in the number or datatype of arguments or in the order of arguments.

When we want to override a method, we ensure that the method is not throwing checked exceptions that are new or higher than those declared by the overridden method. Also we make sure that the method name, arguments and return type remain the same.

Also we cannot override Static and Final methods in Java.



You May Interest

What is the Difference Between DOM and SAX Parser in Java ?

Why String Class is Immutable or Final in Java ?

How Can We Reference an Unreferenced Object Again in Java ?

What are the Main Uses of Spring MVC Module ?

How Will You Define the Scope of a Bean in Spring ?