---
title: "Method overlaoding in JAVA"  
description: "If a class have multiple methods by the same name but different parameters it is known as method overloading. If we have to perform only one operatio"  
author: "ANkita gupta"  
published: 2015-05-29  
updated: 2018-02-25  
canonical: https://www.mindstick.com/blog/10902/method-overlaoding-in-java  
category: "java"  
tags: ["java"]  
reading_time: 1 minute  

---

# Method overlaoding in JAVA

If a class have [multiple](https://www.mindstick.com/blog/12797/iowa-is-expected-to-see-heavy-growth-in-multiple-sectors) [methods](https://www.mindstick.com/articles/13060/runny-nose-remedy-methods-that-work-best) by the same name but different [parameters](https://www.mindstick.com/articles/87/passing-parameters-in-c-sharp) it is [known as](https://answers.mindstick.com/qa/35703/ricky-ponting-is-also-known-as-what) [method overloading](https://www.mindstick.com/articles/12033/method-overloading-in-c-sharp).

If we have to perform only one [operation](https://www.mindstick.com/forum/33917/how-to-callback-operation-using-delegate-in-c-sharp), [having](https://answers.mindstick.com/qa/92506/what-is-the-difference-between-having-clause-and-where-clause-in-sql-server) the same name of the methods increases the readability of the program. Highlighted one is the advantage of the method overloading.

#### The different way to overload the method:

- By changing number of [arguments](https://answers.mindstick.com/qa/92535/what-are-the-different-types-of-arguments)
- by changing the data type

###### Example of method overloading by changing the number of arguments:

```
class Calculation{     void sum(int a,int b){System.out.println(a+b);}
void sum(int a,int b,int c){    System.out.println(a+b+c);}
public static void main(String args[]){     Calculation obj=new Calculation();     obj.sum(10,10,10);     obj.sum(20,20);}
```

**[Output](https://www.mindstick.com/forum/161319/how-does-the-print-function-handle-output-in-python):**

30

40

---

Original Source: https://www.mindstick.com/blog/10902/method-overlaoding-in-java

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
