What is method overloading in java ?

A class having two or more methods with same name but with different arguments then we say that those methods are overloaded. Static polymorphism is achieved in java using method overloading.

Method overloading is used when we want the methods to perform similar tasks but with different inputs or values. When an overloaded method is invoked java first checks the method name, and the number of arguments, type of arguments; based on this compiler executes this method.

Compiler decides which method to call at compile time. By using overloading static polymorphism or static binding can be achieved in java.

Note : Return type is not part of method signature. we may have methods with different return types but
return type alone is not sufficient to call a method in java.

Recent Posts

Explain Platform?

Any hardware or software environment in which a program runs, is known as a platform.…

5 years ago

What is Multi-threading in Java?

Multi-threading is a Java feature that allows concurrent execution of two or more parts of…

5 years ago

What is ‘IS-A’ relationship in java?

'is a' relationship is also known as inheritance. We can implement 'is a' relationship or…

5 years ago

Explain Java Coding Standards for Constants?

Constants in java are created using static and final keywords. Constants contains only uppercase letters.…

5 years ago

Explain Java Coding Standards for variables ?

Variable names should start with small letters. Variable names should be nouns. Short meaningful names…

5 years ago

Explain Java Coding standards for Methods?

Method names should start with small letters. Method names are usually verbs If method contains…

5 years ago