January 2014
Intermediate to advanced
736 pages
70h 43m
English
Class AccountTest (Fig. B.10) creates two Account objects (lines 10–11) and initializes them with 50.00 and -7.53, respectively. Lines 14–17 output the balance in each Account by calling the Account’s getBalance method. When method getBalance is called for account1 from line 15, the value of account1’s balance is returned from line 27 of Fig. B.9 and displayed by the System.out.printf statement (Fig. B.10, lines 14–15). Similarly, when method getBalance is called for account2 from line 17, the value of the account2’s balance is returned from line 27 of Fig. B.9 and displayed by the System.out.printf statement (Fig. B.10, lines 16–17). The balance of account2 is 0.00, because the constructor ensured that ...
Read now
Unlock full access