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

can any one tell me when do u go for inheritance and
polymorphism

Answer Posted / krish

Inheritance:Your are in a situation where you have to the
properties of a whole class repeatedly then you can go for
inheritance.
Note:Final class can't be inherited.

Polymorphism:When you are in a situation where you need to
use a method repeatedly then you can go for polymorphism.
Eg:
consider this method
add(int i,int j) and add(String s1,String s2)
the former will add two integers and later will concatenate
two strings but both using the same method name.

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain about varargs in java?

1185


Why is java called java?

1102


What are the types of methods in java?

1181


Explain about exception propagation?

1102


What is java and its types?

1168


What is garbage collection? What is the process that is responsible for doing that in java?

1157


What is a dynamic array java?

990


Print Vertical traversal of a Binary Tree.

1064


What are "class access modifiers" in Java?

1208


What is exception hierarchy in java?

1073


Which number is denoted by leading zero in java?

1314


How do we access static members in java?

1157


What is the difference between private & public & friendly classes?

1112


What is difference between string and stringbuffer?

1201


What will happen if non-synchronized method calls a static synchronized method and what kind of lock it acquires?

1200