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 same as procedures?

940


When should we create our own custom exception classes?

982


What is array command?

1115


How to use arraylist in java netbeans?

988


Explain treeset?

1064


Explain about interrupt() method of thread class ?

1078


What is meant by anonymous class?

986


Can we use both this () and super () in a constructor?

977


Explain the importance of join() method in thread class?

1073


What is method reference in java?

1073


Difference between collection, collection and collections in java?

965


Can we override constructor?

978


What is the equal sign?

1051


Why collection doesn’t extend cloneable and serializable interfaces?

1062


How do you create immutable object in java?

1006