'Interface to interface association in the book Head First Design Patterns

The book Head First Design Patterns presents the following UML as an example of the Observer pattern:

enter image description here

What strikes me in this diagram is the association relationship between the Subject and Observer interfaces. As far as I understand Java interfaces, they cannot implement a "Has-a" relationship in this way.

When I look at the implementation example provided a few pages later, I find that sure enough, the interfaces are plain old interfaces:

public interface Subject {
  public void registerObserver(Observer o);
  public void removeObserver(Observer o);
  public void notifyObservers;
}

public interface Observer {
  public void update(float temp, float humidity, float pressure);
}

Instead, the association relationship is implemented in the concrete WeatherData and Display classes:

public class WeatherData implements Subject {
  private List<Observer> observers;
  //more code
}

Which does not correspond to the UML and feels a bit wrong to me. Why not just implement Subject as an abstract class instead? Does the UML spec formalize the idea of associating an interface with another interface?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source