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 access instance variables within static methods ?
State one difference between a template class and class template.
How is final different from finally and finalize?
Can set contain duplicates?
What is the ==?
How do you define a set in java?
What is a condition in programming?
What is string in java? String is a data type?
What is difference between Heap and Stack Memory?
What is a ternary operator in java? What is an interface?
Is java a compiler?
Can array grow dynamically in java?
Can a constructor call the constructor of parent class?
What is data type in java?
What is type inference in java8?