第三方

public class TemperatureGUI implements Observable{
 ArrayList(<Observable>) observersList = new ArrayList(<Observable>);
   
   public void register (Observer obs) {  observersList.add(obs);}
   public void unRegister(Observer obs){ observersList.remove(obs); }
   public void notifyObservers(String temperature) {
      for (int i = 0; i < observersList.size(); i++) {
         Observer observer=(Observer)observersList.elementAt(i);
         observer.update (this, temperature); //call update method in all the 
                                                                    //observers
      }
   }

你可能感兴趣的:(String,Class)