The Java API uses this pattern in the event model of its AWT/Swing Classes
-
Strategy Pattern.
-
Template Pattern.
-
Observer pattern.
-
None of the above.
C
Correct answer
Explanation
Java's AWT/Swing event model uses the Observer pattern (also called Listener pattern in this context). Components (subjects) maintain lists of listeners (observers) and notify them when events occur (like button clicks). Listeners implement event listener interfaces and register with components to receive notifications. Strategy and Template patterns don't describe this publish-subscribe relationship.