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
Q43: a(n. _ object is used to control
Q47: Examine the SharedData class shown below. Suppose
Q48: Assume two threads share a BankAccount object
Q49: Assume two threads share a BankAccount object
Q50: A waiting thread is blocked until another
Q53: Assume two threads share a BankAccount object
Q54: Consider the addFirst method of the LinkedList
Q56: Examine the SharedData class shown below. Suppose
Q57: Examine the SharedData class shown below. Suppose
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