?? control.java
字號:
package waitANDnotify;
public class Control {
int n;
boolean valueSet;
synchronized int get(){
if(valueSet){
try{
wait();
}catch (InterruptedException e){
System.out.println("InterRuption occur.");
}
}
System.out.println("Got: "+n);
valueSet=false;
notify();
return n;
}
synchronized void put(int n){
if(valueSet){
try{
wait();
}catch(InterruptedException e){
System.out.println("InterRuption occur.");
}
}
this.n=n;
System.out.println("Put: "+n);
valueSet=false;
notify();
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -