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

Is multiple inheritance supported by java?

1008


What are the two types of java programming?

1079


What are computer functions?

963


How many characters is 2 bytes?

1010


Can we declare an interface as final?

1079


What is the main purpose of java?

1107


When super keyword is used?

1028


Is hashmap thread safe?

1009


What do you understand by java virtual machine?

1209


What is the SimpleTimeZone class?

2294


What is initial size of arraylist in java?

1072


How can a gui component handle its own events?

1123


What is callablestatement? How you can call stored procedure to pass in parameter?

1038


What do you know about java?

972


what is mena by object block any what is the use of that

2223