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

What is the inheritance?

945


How does finally block differ from finalize() method?

1015


Explain JMS in detail.

978


what do you mean by classloader in java?

985


Why set do not allow duplicates in java?

1028


What do you mean by mnemonics?

1010


What is hashmap in java?

1028


What are parameters in a method?

1062


What is the use of a conditional inclusion statement in Java ?

1056


Can you give few examples of final classes defined in java api?

967


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

1036


What are the two ways to create a thread?

967


What is unicode datatype?

937


What is an exception? difference between Checked and Unchecked exception in Java

975


What does bitwise or mean?

1045