面試題:用Java語言模擬一個觀察者模式。

面試題:用Java語言模擬一個觀察者模式。 先看測試程序: 有一個被觀測的對象天氣類——Whether 兩個天氣觀察者——WhetherDisplay1,WhetherDisplay2。 天氣改變後,兩個觀察者輸出觀察結果。 public class Test { public static void main(String[] args) { Whether whether=new
相關文章
相關標籤/搜索