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

What is the difference between jvm and jre? What is an interface?

1090


What does s mean in regex?

1010


How to do a true java ping from windows?

1136


Explain the importance of finally block in java?

954


Describe different states of a thread.

997


Explain the protected field modifier?

1077


What is the difference between inner class and nested class?

1079


What was java originally called?

950


Which collection allows duplicate values in java?

966


Differences between traditional programming language and object oriented programming language?

1120


What is the difference between array and array list in java?

1216


How many types of design patterns are there?

1097


Why do we need wrapper classes?

1065


What is the purpose of javac exe?

1088


What is a null check?

989