0 votes
12 views
in JAVA by (1 point)
Difference between ‘IS-A’ and ‘HAS-A’ relationship in java?

IS-A relationship HAS- A RELATIONSHIP

Is a relationship also known as inheritance Has a relationship also known as composition or

aggregation.

For IS-A relationship we uses extends keyword For Has a relationship we use new keyword

Ex : Car is a vehicle. Ex : Car has an engine. We cannot say Car is an

engine

The main advantage of inheritance is reusability of

code

The main advantage of has a relationship is

reusability of code.

1 Answer

0 votes
by (4.4k points)

IS-A relationship HAS- A RELATIONSHIP

Is a relationship also known as inheritance Has a relationship also known as composition or

aggregation.

For IS-A relationship we uses extends keyword For Has a relationship we use new keyword

Ex : Car is a vehicle. Ex : Car has an engine. We cannot say Car is an

engine

The main advantage of inheritance is reusability of

code

The main advantage of has a relationship is

reusability of code.

Related questions

0 votes
26 views
asked Jun 17, 2019 in JAVA by reins.robin (1 point)
0 votes
13 views
asked Jun 16, 2019 in JAVA by reins.robin (1 point)
...