Multiple Choice
Consider the following change to the deposit method in Section 21.4: public void deposit(double amount)
{
BalanceChangeLock.lock() ;
Try
{
Double newBalance = balance + amount;
Balance = newBalance;
}
Finally
{
BalanceChangeLock.unlock() ;
}
System.out.println("Depositing " + amount + ", new balance is " + balance) ;
}
What is the consequence of this change?
A) The bank account balances may no longer be correctly updated.
B) The printouts may become intermingled.
C) The printouts may no longer display the correct balances.
D) All of the above.
Correct Answer:

Verified
Correct Answer:
Verified
Q6: Which of the following definitely indicates that
Q6: Which exception must be caught or declared
Q7: Which of the following does not create
Q12: Assume two threads share a BankAccount object
Q26: The sleep method is terminated with a(n)
Q33: When a sleeping thread is interrupted, a(n)
Q45: Insert the statement that would start the
Q55: To start a thread, you should first
Q58: The _ interface is designed to encapsulate
Q66: The _ occurs when a thread that