Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

How do you override a method?

983


what is the purpose of the runtime class?

1028


What is the difference between a break statement and a continue statement?

1002


Can vector have duplicates in java?

904


What are the advantages of exception handling in java?

1016


What will be the default values of all the elements of an array defined as an instance variable?

1002


Explain about procedural programming language or structured programming language and its features?

1051


why an outer class cannot be declared as private?

4249


What are wrapped classes in java programming?

1038


Can we overload the main() method?

1006


How many types of interfaces are there?

1008


What is lifetime variable?

921


Difference between string s= new string (); and string s = "abv";?

1175


what methods would you overwrite in java.lang.object class?

973


Can we override constructors?

958