good.java
来自「观察者模式」· Java 代码 · 共 41 行
JAVA
41 行
package Observe.good;
import java.util.Observable;
public class Good extends Observable {
private double price;
private String name;
private String madefrom;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
this.setChanged();
this.notifyObservers("n:"+name);
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
this.setChanged();
this.notifyObservers(new Double(price));
}
public Good(){
super();
}
public String getMadefrom() {
return madefrom;
}
public void setMadefrom(String madefrom) {
this.madefrom = madefrom;
this.setChanged();
this.notifyObservers("m:"+madefrom);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?