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
When throw keyword is used?
What is immutability in java?
What do you mean by buffering?
What is string in java?
In java, what is the difference between method overloading and method overriding?
What is javac used for?
What is an anonymous class in java?
Do you know why doesn't the java library use a randomized version of quicksort?
When a thread is executing synchronized methods , then is it possible to execute other synchronized methods simultaneously by other threads?
Write a function to print Fibonacci series and Tribonacci series?
Can we create constructor in abstract class ?
What does function identity () do?
What is the diffrence between inner class and nested class?
Outline the major features of java.
What is the use of conditional statement?