vendredi 11 septembre 2015

What's the significance of the second arguement in update() in Observer interface method

While studying the Observer Pattern The Observer interface has the update method :

public void update(Observable obs, Object obj)

The first parameter is the observer that issued the update() method , but I fail to understand the second parameter Object obj . The Oracle documentation states it as :

arg - an argument passed to the notifyObservers method.

If I try to print it , java throws NPE, if it's null what's the use of it?

Aucun commentaire:

Enregistrer un commentaire