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

Should a main method be compulsorily declared in all java classes?

996


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

1158


Explain the concept of hashtables?

1058


How do you convert an int to a double in java?

1004


How to reverse string in java?

1134


What does you mean in math?

1009


Can we pass a primitive type by reference in java? How

855


List out five keywords related to exception handling ?

957


What is the difference between quicksort & mergesort? When should they be used? What is their running time?

1025


What is the latest version of java?

1052


I want to persist data of objects for later use. What is the best approach to do so?

1000


How do listeners work?

982


What is contractor means and methods?

944


What is udp in java?

929


What is a local class in java?

987