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

Which collection is sorted in java?

1038


Why do we use predicate in java?

1058


What does provide mean construction?

1108


What is Java Reflection API? Why it’s so important to have?

1170


What is internal variable?

1016


Which collection is ordered in java?

982


How many arguments can be passed to main ()?

997


What is passed by reference and pass by value ?

1035


How many types of operators are there?

986


Why you should not use singleton?

989


What is a file pointer?

1087


What is a variable simple definition?

1027


What is java reflection?

990


What are the 8 primitive data types in java?

1031


What is return code?

1017