正在加载图片...
rivate String weather 白申 public void update(observable obj, object arg) weather =(String) arg ∥捕获天气变化情况,反馈给检测者 System。 out printIn("近期天气变化:"+ weather) 客户端调用:气象局 WeatherService) 日田/ 客户端调用:天气预报 @author zun @version 1.0 create on 2006-5-18 9: 57: 19 日甲 public class WeatherService 白中 @param args pe public static void main(Stingl args)( Earth earth new Earth Satellite satellite new Satellite ∥发射气象卫星 earth. addobserver(satellite System. out. println("天气预报:")private String weather; public void update(Observable obj, Object arg) { weather = (String) arg; // 捕获天气变化情况,反馈给检测者 System.out.println( " 近期天气变化: " + weather); } } 客户端调用:气象局(WeatherService) /** * 客户端调用:天气预报 * * @author zjun * @version 1.0 create on 2006-5-18 9:57:19 */ public class WeatherService { /** * @param args */ public static void main(String[] args) { Earth earth = new Earth(); Satellite satellite = new Satellite(); // 发射气象卫星 earth.addObserver(satellite); System.out.println( " 天气预报: " );
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有