?? banking.java
字號(hào):
package examples.threads.bank;
/**
* A class to demonstrate wait and notify methods
*/
public class Banking {
/** The test method for the class
* @param args[0] Time in seconds for which
* this banking process should run
*/
public static void main( String[] args ) {
BankAccount ba = new BankAccount();
// create the spender thread
Spender spenderThread = new Spender( ba );
// create the saver thread which is a two-step
// process because Saver implements Runnable
Saver aSaver = new Saver( ba );
Thread saverThread = new Thread( aSaver );
spenderThread.start();
saverThread.start();
int time;
if ( args.length == 0 ) {
time = 10000;
} else {
time = Integer.parseInt( args[0] ) * 1000;
}
try {
Thread.currentThread().sleep( time );
} catch ( InterruptedException iex ) {
/* ignore it */
}
// close the bank account
ba.close();
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -