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 / sitaram

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;
}

}
public class Over extends OverloadDemo{
public static void main(String[] args) {
OverloadDemo od = new OverloadDemo();
int a = od.test(12.456); //error:Can't convert from
double to int.
}
}

Program not compiled . because Can't convert from double to int.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which collection allows duplicate values in java?

977


What are the steps involved to create a bean?

1165


What is an example of a boolean?

1072


What isan abstract class and when do you use it?

1611


How do you classify Dialog Box?

1128


What are controls and their different types in awt?

1091


Difference between concurrent hashmap and hashtable and collections

1073


Is overriding possible in java?

967


How do you read a char in java?

1035


What is the format specifier?

950


Write a program to print count of empty strings in java 8?

1012


Can there be an abstract method without an abstract class?

965


What classes of exceptions may be thrown by a throw statement?

976


What are the advantages of exception handling?

1067


What is a variable simple definition?

1030