In which scenario we use method overloading.? Or what is the use of this provision in programming? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

In which scenario we use method overloading.? Or what is the use of this provision in programming?

21st Jul 2016, 4:01 AM
anu Joseph k
anu Joseph k - avatar
1 Answer
+ 1
you can use method overloading if you need two or more method from one class with the same name. example public int add(int a) public int add(int a, int b) so if you want to call this method you can do like this add(5) or add(5,8)
26th Jul 2016, 4:29 AM
Róbert Pécz
Róbert Pécz - avatar