Consider the following change to the deposit method in Section 20.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
Q41: The thread that calls signalAll must own
Q43: a(n. _ object is used to control
Q46: Examine the SharedData class shown below. Suppose
Q47: Assume two threads share a BankAccount object
Q50: A waiting thread is blocked until another
Q51: _ allow a thread to temporarily release
Q52: Examine the SharedData class shown below. Suppose
Q53: Examine the SharedData class shown below. Suppose
Q54: Consider the addFirst method of the LinkedList
Q58: If a thread sleeps after acquiring a
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents