62,621
社区成员
发帖
与我相关
我的任务
分享class dataDemo {
private int prority = 0; // From 1 to 5, for example
private Object data = null;
public dataDemo(Object obj, int prority) {
this.data = obj;
this.prority = prority;
}
public Object getData(int prority) throws Exception {
if (prority < this.prority) {
throw new Exception();
}
else return data;
}
public void resetData(Object obj, int prority) throws Exception {
if (prority < this.prority) {
throw new Exception();
}
else this.data = obj;
}
}