What is the method overloading in java?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 20

What is the method overloading in java??

8th Nov 2017, 3:35 AM
Jyoti Giri
10 Answers
+ 18
It's basically methods with the same name, but different parameters. https://www.javatpoint.com/method-overloading-in-java
8th Nov 2017, 3:42 AM
qwerty
qwerty - avatar
+ 15
It will be more good that you Google it. You can get more information on Google with better explanation.
9th Nov 2017, 3:44 AM
Mayank Sakhare
Mayank Sakhare - avatar
+ 7
I would like to study Java after I do c++ and html also is there a c language on here I see c++ and c# and css??
25th Dec 2017, 7:30 PM
John Schmidt
John Schmidt - avatar
+ 6
Method overloading is a programming technique to call two different methods by single name. Method overloading can be done by either changing the number of arguments it take or changing the return type of the function. Eg: 1) int add(int x,int y) { return (x+y); } 2) int add(int x,int y,int z) { return (x+y+z); } Now, If you type add(2,3) first method will be called. And if you type add(2,3,4) second method will be called.
20th Feb 2018, 5:49 AM
Junaid Siddiqui
Junaid Siddiqui - avatar
+ 3
this question is more appropriate to google yourself.
8th Nov 2017, 4:20 AM
Salekin
Salekin - avatar
+ 3
same method name with different parameters. it will call that method which match your parameters :-)
12th Nov 2017, 8:41 AM
Waseem Ullah
Waseem Ullah - avatar
+ 3
method overloading is nothing but using a single method name to define method to perform different tasks based upon the type of input it gets. for ex- int sum(int,int) will return the sum in integer while float sum(float,float) will return the sum in float even though both methods have same name.
22nd Dec 2017, 11:53 AM
Neelansh Parashar
Neelansh Parashar - avatar
+ 3
public float area(int r) {return(3.14*r*r);} //Area of circle public int area(int h,int w) {return (h*w);} //Area of rectriangle As you can see there are two different method with same name "area" but their return type and number of parameters are different. Now compiler decides which one will be bind when you call the function implicitly. If you pass one argument then first method will be bind ( Area of circle). If you pass two argument then second method will be bind ( Area of rectriangle) .......... Hope you understand.........
13th Jan 2018, 2:07 AM
Pushpajit-Biswas
Pushpajit-Biswas - avatar
+ 2
two or more methods same name with different signature in a class.
12th Nov 2017, 10:17 AM
Rkumar
Rkumar - avatar
+ 2
nestad loop is good for overloding
2nd Dec 2017, 7:14 AM
Rahul Erpache
Rahul Erpache - avatar