What is the purpose of having the concept of overloading?

Answers were Sorted based on User's Feedback



What is the purpose of having the concept of overloading?..

Answer / vinay

overloading is used to achieve reusability and extensibility

Is This Answer Correct ?    23 Yes 3 No

What is the purpose of having the concept of overloading?..

Answer / narendra

Method overloading is one of the ways that Java implements
polymorphism. It allows related methods to be accessed by
use of a common name. Use it when you actually do need
multiple methods with different parameters, but the methods
do the same thing.

Is This Answer Correct ?    13 Yes 2 No

What is the purpose of having the concept of overloading?..

Answer / 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

What is the purpose of having the concept of overloading?..

Answer / geeta

Some times same Object should act differently in differnet
places and in different time . In that case java goes with
overloading.

Is This Answer Correct ?    5 Yes 3 No

What is the purpose of having the concept of overloading?..

Answer / sridharan

Consider if u have a string and u want to find the length
of a string, so u have
getLength(String name) method which will return the length
of the string. Also if u feels that u want to find the
length of a string from the specified position or
character. So we can have same name but with one more
parameter to specify the character position. So we will
have getLength(String name, int a)

Is This Answer Correct ?    2 Yes 1 No

What is the purpose of having the concept of overloading?..

Answer / siddhart prasad

Method overloading is used when objects are required to perform similar rasks but with different input parameters.....i think soo.....:-)......when we call a method in an object, java use to match the method name first as well as the no. and different typs of parameters to decide which one of da definitions to execute....the process is known as #static_polymorphism.

Is This Answer Correct ?    1 Yes 0 No

What is the purpose of having the concept of overloading?..

Answer / ajay kumar sharma

Overloading is actually belongs to the concept of
Polymorphism the most important feature of OOP.
And it simply means "Ability to take more than one form".

In a Progarm when a same method(having ame name, return
type,argument list) is used to perform multiple or
different tasks its called as method overloading.

Is This Answer Correct ?    3 Yes 11 No

Post New Answer

More Core Java Interview Questions

what is difference between interface and abstract class..?

4 Answers  


How do you add an element to a set in java?

0 Answers  


What is super keyword in java ?

1 Answers  


Can you achieve runtime polymorphism by data members?

0 Answers  


Does java trim remove newline?

0 Answers  






what is aggregation in java?

0 Answers   IBS,


Why is stringbuffer called mutable?

0 Answers  


What does g mean in regex?

0 Answers  


Hi can u pls tell me what is the use of marker interface. Iknow what is marker interface but what ability will the object get by implementing this.

3 Answers   CGI,


Hi Friends, can you give difference between extending thread class and implementing runnable interface.

4 Answers  


Is array synchronized in java?

0 Answers  


class A{ class B{ } } in which name u save the file,its the program compile?

6 Answers   HCL,


Categories