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

Distinguish method overloading and method overriding

Answer Posted / umanath

Method overloading is compile time polymorphism and method
overriding is Runtime polymorphism.
Method overloading is having same name and different
parameters and different return type also. But same type and
same no:of parameters but different return type is not allowed.
Error while compile: type methodname(type name) is already
defined in classname.
Method overriding same name with same parameters and having
same return type in different class while inheritance is
applied.


Try this following program: this will throw a error while
compiling.....
class OverloadDemo {
int test(int x) {
return x*x;
}

long test(int a) {
long l = a*a*a;
return l;
}

double test(double a) {
return a*a;
}

}

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why Set interface contains unique elements, what internally implemented for this so that it contains unique elements?

8112


What is the role of the java.rmi.naming class?

1072


What is the basic concepts of OOPS?

1202


What is a hashmap used for?

1250


How java enabled high performance?

1057


Explain 5 io best practices?

1034


What is string manipulation?

1006


According to java operator precedence, which operator is considered to be with highest precedence?

1087


How can you set an applet’s height and width as a percentage?

931


What is the different types of functions?

1057


What about main() method in java ?

1020


When a byte datatype is used?

2210


What do you mean by pointer value and address?

1052


Why stringbuilder is not thread safe?

1034


What ide should I use for java?

1030