Answers for "has a vs is a relationship in java"

1

is a relationship in java

‘is a’ relationship is also known as inheritance. We can implement 
‘is a’ relationship or inheritance in java using extends keyword. 
The advantage of inheritance or is a relationship is reusability of code 
instead of duplicating the code.
  
Ex : 
Motor cycle is a vehicle
Car is a vehicle 
Both, car and motorcycle extends vehicle.
Posted by: Guest on November-30-2020
0

is a and has a relationship in java

class Apple extends Fruit {

}
Posted by: Guest on January-12-2021
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 "has a vs is a relationship in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language