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
Can we have any other return type than void for main method?
What is a parameter in a function?
Describe different states of a thread.
How an object is serialized in java?
Explain methods specific to list interface?
What is the disadvantage of synchronization?
Can we override constructor in java?
How do you clear an arraylist in java?
Does constructor return any value?
Is hashmap thread safe?
what is the volatile modifier for? : Java thread
Why does abstract class have constructor?
Is null a string or object in java?
What is java in detail?
Can we clone singleton class in java?