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 does the string method compareto () do?

1113


Which collection does not allow duplicates in java?

1031


What are the uses of java?

1140


What is an empty class? What functionality does it offer in Java?

1348


Explain the difference between association, aggregation and inheritance relationships.

1155


What is an immutable object?

1171


What is the difference between hashmap and hashtable? What is an interface?

1236


Explain the use of javap tool.

1185


What are the advantages of java over cpp?

1126


What are peerless components in java programming?

1066


What is null statement?

1070


Which eclipse is best for java?

1055


In java, how many ways you can take input from the console?

1042


How can we make string upper case or lower case?

1139


What are 5 boolean operators?

1250