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
What is early binding and late binding in java?
What is run time allocation?
How to read and write image from a file ?
Can we make the abstract methods static in java?
What are the differences between heap and stack memory in java?
Can we use string in switch case in java?
Can you make a constructor final?
Explain the differences between static and dynamic variables?
placement papaers of spring computing technology
What is the base class in java from which all classes are derived?
How to sort numbers in java without array?
What is == and === in javascript?
How do you check whether the list is empty or not in java?
What is lambda programming?
What are the types of sockets in java?