Assume three threads share a BankAccount object with a balance initially zero (0) , a ReentrantLock named myLock, and a condition object on myLock named insufficientFunds, as shown below.Thread one calls withdraw(30) , then thread two calls withdraw(20) and thread three calls deposit(45) .What is the balance after the three calls and after the waiting threads have had a chance to run?
A) 0
B) 15 or 25
C) 45
D) -5
Correct Answer:
Verified
Q62: A GUI should be responsive to the
Q63: Calling the wait method in synchronized code
Q64: Which are ways that a thread can
Q65: When is it a good idea to
Q66: Under what conditions are locks unnecessary for
Q68: What happens when a thread calls the
Q69: lock objects ensure that shared data are
Q70: Why does the textbook recommend signallAll over
Q71: Class MyClass has a single ReentrantLock object,
Q72: Consider an old fashioned telephone booth that
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