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
Differentiate between static and non-static methods in java.
What is the syntax and characteristics of a lambda expression?
Is java based on c?
What happens if I remove static from main method?
Explain the difference between map and flatmap stream operation?
explain copyonwritearraylist and when do we use copyonwritearraylist?
Is set thread safe java?
What is super constructor?
Define how objects are stored in java?
How do I get the | symbol on my keyboard?
can java object be locked down for exclusive use by a given thread? Or what happens when a thread cannot acquire a lock on an object? : Java thread
What does string mean in java?
What is appletviewer?
What is passing value java?
Explain the importance of thread scheduler in java?