Observer design pattern, there is a Subject that maintains the list
of Observers that are waiting for any update on the Subject. Once
there is an update in Subject it notifies all the observers for the
change.
E.g. In real life, students are waiting for the result of their test. Here
students are the observers and test is the subject. Once the result of
test is known, testing organization notifies all the students about
their result.
The most popular use of Observer pattern is in Model View
Controller (MVC) architectural pattern.
Main issue with Observer pattern is that it can cause memory leaks.
The subject holds a strong reference to observers. If observers are
not de-registered in time, it can lead to memory leak.
Observer design pattern is useful when you are interested in the state of an object and want to get notified whenever there is any change.
In observer pattern, the object that watch on the state of another object are called Observer and the object that is being watched is called Subject.
https://www.digitalocean.com/community/tutorials/observer-design-pattern-in-java