Beer Info FAQ

Has-a relationship in Java example?

Has-a relationship in Java example?

In Java, a Has-A relationship essentially implies that an example of one class has a reference to an occasion of another class or another occurrence of a similar class. For instance, a vehicle has a motor, a canine has a tail, etc. In Java, there is no such watchword that executes a Has-A relationship.

Is a and has-a relationship in Python?

An IS-A relationship is inheritance. The classes which inherit are known as sub classes or child classes. On the other hand, HAS-A relationship is composition. This means, that the child class is a type of parent class.