In method overloading ,if i change the return type to Long
instead of INT,is the program execute
Answer Posted / umanath
Write a following program:
class OverloadDemo {
int test(int x) {
return x*x;
}
int test(long a) {
long l = a*a*a;
return l;
}
double test(double a) {
return a*a;
}
}
Compile that program:
C:\>javac OverloadDemo.java
OverloadDemo.java:9: possible loss of precision
found : long
required: int
return l;
Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
Can we declare main () method as non static?
What is meant by collection in java?
Can java inner class be static?
Explain abstract class in java?
What is a singleton in genetics?
Explain static nested classes ?
What is a finally block?
How to retrieve data from database in java using arraylist?
What is printwriter in java?
What is the meaning of nullable?
Can a constructor have different name than a class name in java?
What are different types of classloaders?
How many types of operators are there?
What is nested interface?
What is meant by the value of a variable?