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...

The following program is Overloading or Overriding?
public class PolymorphismEx {
public int sampleMethod(int a) {
return a;
}

public String sampleMethod(int a) {
return "Is it Overloading or Overriding???";
}
}

Answer Posted / hemanth

Its Neither Overloading nor overriding, Because for Overloading there should some Variation in argument list and for overriding the return type(if Primitive) should be same.
int method(int a)
{
}
String method(int a)
{
}
arguments should be different for overloading
return type should be same(if primitive) for overriding

so its improper which results in compile time error.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is identifier in java?

1173


What are the uses of synchronized keyword?

1051


What is the locale class in java programming?

1154


Explain the difference between map and flatmap stream operation?

1307


These static constructors are correct ? class A { statc intA() { } static A(int x,int y) { } static A(int x) { } }

1132


Is a boolean variable?

1063


What is the difference between overriding & overloading?

1137


How do you do exponents in java?

1100


explain different ways of using thread? : Java thread

1059


What is gc()?

1136


What is the output of the below java program?

1094


What is the use of optional ?

1087


Can we use static class instead of singleton?

1098


What does the string method compareto () do?

1113


How do you escape in java?

1134