An 'is-a' relationship has to do with subclassing when talking about other classes, or implementation when speaking about interfaces
interface I {}
class A{}
class B extends A implements I {}
here we can say
class B 'is-a' subclass of class A
class B 'is-a' implementation of interface I
One way to check an is-a relationship is to use the instanceof operator,
using the above classes, if:
B b = new B();
then the boolean value of:
(b instanceof A) will be true
(b instanceof I) will be true
An 'has-a' relationship refers to containment, where one object contains another object, not to be confused with inner-classes
I the above code, we can see that class B contains a reference of type class A, so we can say that class B 'has-a' class A relationship
NOTE: the 'has-a' relationship has to do with containment of reference types and not
java primitive types!!!
So in the previous code we can't say class B 'has-a' char, even though it contains a char field 'c'
