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 / kishor patil

Inheritance defines the relationship is-a(also called the
superclass-subclass relationship) between a superclass and
it's subclasses. This means that an object of a subclass
is-a superclass object,and can be used wherever an object
the of superclass can be used.

For EX-Suppose person is a superclass of Teacher
class,Driver class,Engineer class.

Here we can say every Teacher is person,Every Driver is
a person,And Every Engineer is a person ,but vice -versa
not true i.e Every person can not be teacher or driver or
Engineer.


Aggregation Defines the relationship has-a(also called
whole-part relatioship)between an instance of class and
it's constituents(also called parts).Aggregation comprises
the usage of objects.

We can say that a composite object built from the
constituent objects that are its parts .


For EX- Vehical is class.

vehical has a wheel,
vehical has a engine,
vehical has a stearing ,
vehical has a gear.


means vehical has a parts like
wheel,engine ,stearing ,gear.

Is This Answer Correct ?    24 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between procedural and object-oriented programs?

924


What is stored procedure. How do you create stored procedure ?

1889


What does I ++ mean?

999


What are measurable parameters?

1012


What are the advantages of assembly language?

872


Explain when noclassdeffounderror will be raised ?

987


What is boolean logic?

967


What is collection sort in java?

895


What are different types of references?

929


what is the difference between yielding and sleeping? : Java thread

905


Difference between keyword and identifier.

970


Can a static block throw exception?

1045


What is entry in java?

967


What is the difference between synchronized and synchronized block?

1005


Difference between notify() method and notifyall() method in java?

912