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
How do you override a method?
what is the purpose of the runtime class?
What is the difference between a break statement and a continue statement?
Can vector have duplicates in java?
What are the advantages of exception handling in java?
What will be the default values of all the elements of an array defined as an instance variable?
Explain about procedural programming language or structured programming language and its features?
why an outer class cannot be declared as private?
What are wrapped classes in java programming?
Can we overload the main() method?
How many types of interfaces are there?
What is lifetime variable?
Difference between string s= new string (); and string s = "abv";?
what methods would you overwrite in java.lang.object class?
Can we override constructors?