Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

has a relationship in java

‘Has a ‘ relationship is also known as “composition or Aggregation”. 
As in inheritance we have ‘extends’ keyword we don’t have any keyword to 
implement ‘Has a’ relationship in java. The main advantage of ‘Has-A‘ 
relationship in java code reusability. For has a relationship we use new keyword

Ex: Car has an engine. We cannot say Car in an engine.
 
PREVIOUS NEXT
Tagged: #relationship #java
ADD COMMENT
Topic
Name
3+2 =