I’m pretty much java beginner, and i’ve come to ask stackoverflow forum for one simple question. I already checked similar question here on SO, but i didn’t found the desired answer, LINK: Is there any relation between the class that implements interface and that interface?
We know if Cat extends Animal, there is a relationship here. So Cat is-a Animal ( but not necessarily otherwise. Animal is also a Dog..). We know this relationship as “is-a” – inheritance.
If we have another two classes: Girl and Candy and if class Girl holds instance of Candy, then we name this relationship “has-a”-composition, because we can say that Girls has-a Candy.
Correct me if i made something wrong with above examples.
Anyway my question is if its there some relationship between objects of classes that implement the same interface? Let’s say:
public class A implements InterfaceA {}
public class B implements InterfaceA {}
If there is some relationship, how we can make use of that relationship? Thanks for your answers in advance..
EDIT: For those who think that there isn’t a relationship, i have a book “java how to program ninth edition” and there is a UML diagram which shows classes that implements same interface in “relationship” ?
Image:

There is no relationship between the objects which implement same interface. Both are independent implementations of their own. They just follow the protocol defined by interface.
If you try to cast from one object type to another object type, you will end-up getting
ClassCastException.EDIT:
Your UML diagram suggest that there is relationship between interface and class (IS-A), but not between the two classes which implement same interface. There is no line with relationship symbol between the classes (like you see between class and interface)