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

I want to re-reach and use an object once it has been garbage collected. How it's possible?

768


Objects or references which of them gets garbage collected?

725


What is the access scope of protected access specifier?

748


Explain the difference between the public, private, final, protected, and default modifiers?

785


What is Classloader in Java?

824


why java uses class level type casting ?

2427


What is the use of math abs in java?

740


Where is const variable stored?

699


Difference between start() and run() method of thread class?

811


What loop means?

743


What is public/private protected in java?

780


What is multiple inheritance? Is it supported by java?

717


Can we have two main methods in a java class?

775


5 Coding best practices you learned in java?

817


what is the difference between thread and runnable types? : Java thread

761