what is overloading in java?

Answer Posted / sivaprasad addepalli

Method Overloading comes into picture when there are two
methods with same name but it must differ in one of the
follwing:

--> Number of arguments.
--> Datatype of arguments.
--> Order of the arguments.

for ex:

class sample
{
public:

void add (int a, int b)
{
}
void add (int a, int b, int c)
{
}
}

In this case the number of arguments are different so it is
method overloading.

Is This Answer Correct ?    20 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is use of inner class in java?

516


What is a dynamic array java?

521


How do you use compareto method?

531


what is static import in java? Explain

555


What is the maximum size of a string in java?

551






What is the importance of hashcode() and equals() methods?

583


Differentiate jar and war files?

594


Write a java program for binary search?

611


How do you get length in java?

561


What is the use of keywords in java?

555


What is class level lock ?

612


What is runtime polymorphism or dynamic method dispatch?

524


What is final keyword in java? Give an example.

578


What is public/private protected in java?

548


What must a class do to implement an interface in java programming?

540