what is overloading in java?

Answer Posted / irshad ahmad

Method overloading in java:
create more than one methods that have same name, but
different parameter lists and different definitions, within
a class.
It is used when objects are required to performed similar
tasks but with using different input parameter list.

class ABC
{
int x,y,z;
void star(int a,int b,int c)
{
x=a; y=b;z=c;
}
void star(int a,int b)
{
x=a; y= z=b;
}
void star(int a)
{
x= y= z= a;
}

int result()
{
return(x*y*z);
}
}

Is This Answer Correct ?    43 Yes 18 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between synchronize and concurrent collection in java?

520


Why do we need wrapper classes?

578


What is the use of predicate in java 8?

492


Hi friends am new to java. I read jar file means collection of java files. For executing struts application what are the necessary jar files. " struts.jar " file contains what. can u explain

1435


What are internal variables?

559






Is sizeof a keyword in java programming?

610


What is difference between call by value and call by reference?

503


How do weakhashmap works?

590


What are the library functions in java?

550


What is empty string literal in java?

562


Can we clone singleton object in java?

566


Is it possible to instantiate the abstract class?

540


What is local variable and instance variable?

609


Can you pass by reference in java?

526


Detail discussions on JVM, memory management and garbage collector.

552