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
What is a predicate method?
How to obtain a performance profile of java program
What is runtime polymorphism or dynamic method dispatch?
Explain notify() method of object class ?
What is heterogeneous in java?
What does @param args mean in java?
what is the purpose of using rmisecuritymanager in rmi?
how does multithreading take place on a computer with a single cpu? : Java thread
Does java support Operator Overloading?
What an i/o filter in java programming?
What does .equals do in java?
What is the difference between path and classpath variables?
What are the legal operands of the instanceof operator?
What are the properties of thread?
What is method and methodology?