Implementing The Observer Pattern In Java
Article by:Geoffrey Hunter
The following examples shows you how to manually implement the Observer pattern in Java.
Since the interface is public, it has to be described in it’s own file.
The Java framework provides the
java.lang.Observable classes to standardise the way the observer pattern is implemented.
The problem is you can attach any
Observer object to any
Observable object, creating potential incorrect-type issues, especially when a project starts to grow in size.
This work is licensed under a Creative Commons Attribution 4.0 International License .