📄 accountimpl.java
字号:
// 值类型Account的实现
package Bank;
public class AccountImpl extends Account {
// 构造方法
public AccountImpl(float init) {
balance = init;
}
// 往账户中存款
public void deposit(float amount) {
balance += amount;
}
// 从账户中取款
public void withdraw(float amount) throws AccountOverdraft {
if (balance < amount) throw new AccountOverdraft();
else balance -= amount;
}
// 查询账户余额
public float getBalance() {
return balance;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -