what is overloading in java?

Answer Posted / saurabh

it is a example of overloading:-
class Overload {
void test(int a) {
System.out.println("a: " + a);
}
void test(int a, int b) {
System.out.println("a and b: " + a + "," + b);
}
double test(double a) {
System.out.println("double a: " + a);
return a*a;
}
}
class MethodOverloading {
public static void main(String args[]) {
Overload overload = new Overload();
double result;
overload.test(10);
overload.test(10, 20);
result = overload.test(5.5);
System.out.println("Result : " + result);
}
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a predicate method?

568


How to obtain a performance profile of java program

547


What is runtime polymorphism or dynamic method dispatch?

526


Explain notify() method of object class ?

615


What is heterogeneous in java?

498






What does @param args mean in java?

556


what is the purpose of using rmisecuritymanager in rmi?

569


how does multithreading take place on a computer with a single cpu? : Java thread

697


Does java support Operator Overloading?

611


What an i/o filter in java programming?

608


What does .equals do in java?

530


What is the difference between path and classpath variables?

533


What are the legal operands of the instanceof operator?

567


What are the properties of thread?

504


What is method and methodology?

608