Skip to content

Commit 0a10fce

Browse files
committed
Update Bank.java
Moved the exception throw into one line
1 parent 73241e1 commit 0a10fce

File tree

1 file changed

+1
-6
lines changed
  • src/com/codefortomorrow/advanced/chapter14/solutions

1 file changed

+1
-6
lines changed

src/com/codefortomorrow/advanced/chapter14/solutions/Bank.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,7 @@ public void deposit(double amount) {
6666

6767
public void withdraw(double amount) throws NotEnoughMoneyException {
6868
if (amount > balance) {
69-
throw new NotEnoughMoneyException(
70-
String.format(
71-
"Bank balance is short $%.2f",
72-
Math.abs(balance - amount)
73-
)
74-
);
69+
throw new NotEnoughMoneyException(String.format("Bank balance is short $%.2f", Math.abs(balance - amount)));
7570
}
7671
balance -= amount;
7772
}

0 commit comments

Comments
 (0)