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
What two classes are used to read data only?
Can array grow dynamically in java?
what is mutual exclusion? How can you take care of mutual exclusion using java threads? : Java thread
Explain the use of volatile field modifier?
What are measurable parameters?
Is arraylist an object in java?
What is qms certification?
What does system out println () do?
Why can't we use static class instead of singleton?
What are pass by reference and pass by value?
how do I create a runnable with inheritance? : Java thread
Where and how can you use a private constructor?
What is anagram in java?
What do you understand by the term wrapper classes?
What are the types of collections in java?