what is overloading in java?
Answer Posted / srujana
To define one or more methods within the same class that
share the same name, as long as thier parameters
declarations are diffrent.These methods are called
overloaded and its process is called Methodoverloading.
For example,
class Demo
{
void test()
{
System.out.println("No parameters");
}
void test(int a)
{
System.out.println("a is:"+a);
}
void test(int a, int b)
{
System.out.println("a is:"+a "," +b);
}
}
class Demo1
{
public static void main(String args[])
{
Demo1 d=new Demo();
d.test();
d.test(5);
d.test(2,3);
}
}
| Is This Answer Correct ? | 27 Yes | 9 No |
Post New Answer View All Answers
Can we convert stringbuffer to string?
What is the driver class?
How to change value in arraylist java?
What is a class in java?
Why java is call by value?
What are keywords and reserved words in java?
How to use string tokenizer class.
What is the use of set in java?
Why are lists ordered in java?
What is the difference between arraylist and hashset in java?
Explain when classnotfoundexception will be raised ?
What are the principle concepts of oops?
Which is a valid identifier?
What is preflight request?
What is the gregoriancalendar class in java programming?