Answers for "What is Is-a and Has-a relationship in Java"

5

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.
Posted by: Guest on November-30-2020
0

is a and has a relationship in java

class Room {

    Table table = new Table();

}
Posted by: Guest on January-12-2021

Code answers related to "What is Is-a and Has-a relationship in Java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language