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
State the merge-sort principle and its time complexity.
What is the most important feature of java? What is an interface?
What is a two-pass assembler?
What is == and === in javascript?
What is lazy initialization in java?
how can i use a nonsynchronized hashtable?
What does pointer mean?
Which class should you use to obtain design information about an object in java programming?
Similarity and difference between static block and static method ?
How do you override a variable in java?
What is the difference between the final method and abstract method?
Is java platform independent?
What are the rules for variable declaration?
List the features of java programming language.
What is the gregoriancalendar class in java programming?