设计模式--使用java内置的观察者模式(Observer Pattern)
?
3、测试类
public class Test {/** * @param args */public static void main(String[] args) {WeatherData wd = new WeatherData();CurrentConditionsDisplay ccd = new CurrentConditionsDisplay(wd);wd.setMeasurements(21, 13, 30.4f);wd.setMeasurements(1, 2, 3f);}}
?