📄 transferatob.java
字号:
class TransferAtoB implements Runnable{ Account acctA, acctB; int amount; public TransferAtoB(Account a, Account b, int amt) { acctA = a; acctB = b; amount = amt; }/* The run() method has one of the Account objects invoke the *//* transfer() method passing the other Account object and the *//* amount of the transaction as arguements. */ public void run() { acctA.transfer(acctB,amount); printBalances(); } public void printBalances() { System.out.println(Thread.currentThread().getName()+ " transaction complete."); System.out.println( " balance of "+acctA.getName()+" = "+acctA.getBalance()+ " balance of "+acctB.getName()+" = "+acctB.getBalance()); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -