What is the purpose of having the concept of overloading?

Answer Posted / anjani kumar jha

Suppose u write a method having two parameter and name of
that method is sum..................that is

public void sum(int a, int b)
{

}
Now suppose later the requirement is modified and u have to
told now sum method should pass three parameter in subclass,
and both the parameter which is called in superclass should
be same............what u gonna do .........

So u have to write to method in subclass one with two
parameter and another with three parameter and suppose again
the parameter increased and due to which u have to write 100
method like that...........that is sucide attempt for a
developer.

So sun told dont worry use the concept of overloading....
same class name with different parameter.......no need to
write the different method........for the same task....

use same method with different parameter is called overloading.

Is This Answer Correct ?    7 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a wrapper method?

528


What is the need of transient variables in Java ?

572


What type of variable is gender?

537


What is an object class?

551


What exceptions occur during serialization?

602






Is int a class in java?

520


What is an array in java?

634


How does remove work in java?

513


Difference between ‘is-a’ and ‘has-a’ relationship in java?

533


Hi i am creating desktop application in that i want calling to mobile number. i have java telephone api (JTAPI) but i dont understand how it configure & use plese help me

1354


What does string intern() method do?

581


Explain about automatic type conversion in java?

561


What is string pool?

622


How does compareto method work?

518


Explain the scope or life time of class variables or static variables?

509