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

What is the is a and has a relation ship in oops concept in
java?

Answer Posted / b venkat reddy

The "is a" relationship is expressed with inheritance and
"has a" relationship expressed with composition.


Both inheritance and composition allow u to place sub-objects inside your new class.Two main techniques to code reuse are inheritance and composition.

Ex.: IS A ===>> house IS A building

class House {
.....
}
class Building extends House{
......
}

Ex.:HAS A ===>> house HAS A bathroom

class House {
Bathroom b = new Bathroom();
}

Is This Answer Correct ?    22 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are decalarations?

1119


Can a function return a function?

1033


What do u mean by variable?

1045


Can we change the scope of the overridden method in the subclass?

1388


What is linkedlist in java?

999


What is a static method in java?

1045


What methods are used to get and set the text label displayed by a button object?

1012


What is lastindexof in java?

1100


What is oops in java?

1013


When do we need to use internal iteration? When do we need to use external iteration?

1120


How destructors are defined in java?

1182


Why do we use string?

1030


What is java in layman terms?

1005


What are the 6 functions?

966


What is a pointer and does java support pointers?

1001