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

Can we access instance variables within static methods ?

1084


State one difference between a template class and class template.

1064


How is final different from finally and finalize?

924


Can set contain duplicates?

993


What is the ==?

878


How do you define a set in java?

1006


What is a condition in programming?

1007


What is string in java? String is a data type?

1014


What is difference between Heap and Stack Memory?

1044


What is a ternary operator in java? What is an interface?

994


Is java a compiler?

971


Can array grow dynamically in java?

967


Can a constructor call the constructor of parent class?

1028


What is data type in java?

897


What is type inference in java8?

1036