?? account_hua.java
字號:
package com.jk.thread;
public class Account_hua {
private double balance;
public synchronized void withdraw (double price){
while(this.balance<price){
try {
wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
this.balance -= price;
System.out.println("Girl consume "+ price + " and balance has "+balance);
}
public synchronized void deposit(double earn){
notifyAll();
this.balance += earn;
System.out.println("Boy earn " + earn + " and balance has " + balance);
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -