// This code will fail, even though both methods are synchronized /** * get the balance * @return balance of this account in pennies */ public synchronized long void getBalance() { return this.balance; } /** * Make a withdrawal from this account * @param withDrawAmount amount to withdraw in pennies */ public synchronized void withdraw( long withdrawAmount ) throws BankingException { if ( withdrawAmount < 0 ) { throw new BankingException( "Negative withrawals should be handled as corrections or deposits" ): } this.balance -= withDrawAmount; }