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
Which collection is sorted in java?
Why do we use predicate in java?
What does provide mean construction?
What is Java Reflection API? Why it’s so important to have?
What is internal variable?
Which collection is ordered in java?
How many arguments can be passed to main ()?
What is passed by reference and pass by value ?
How many types of operators are there?
Why you should not use singleton?
What is a file pointer?
What is a variable simple definition?
What is java reflection?
What are the 8 primitive data types in java?
What is return code?