client.java

来自「这个是我做j2ee培训时候自己整理和编写的设计模式的学习例子」· Java 代码 · 共 14 行

JAVA
14
字号
package org.hyq.observer0;
public class Client  {
	public static void main(String[] args) {	
		DataSubject bag = new DataSubject();
		DataObserver1 do1 = new DataObserver1(bag);
		DataObserver2 do2 = new DataObserver2(bag);
		// adder and printer add themselves to the bag
		System.out.println("About to add another integer to the bag:");
		bag.add("aNewCar");
		System.out.println();
		System.out.println("About to remove an integer from the bag:");
		bag.remove(0);
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?