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?
A) 0
B) 15 or 25
C) 45
D) -5
Correct Answer:
Verified
Q70: Why does the textbook recommend signallAll over
Q71: Class MyClass has a single ReentrantLock object,
Q72: Consider an old fashioned telephone booth that
Q73: Class MyClass has two ReentrantLock objects, myLock1
Q74: Assume two threads share a BankAccount object
Q76: The term "stale data" refers to a
Q77: What is the relationship between synchronized code
Q78: Which of the following scenarios may not
Q79: The term "stale data" refers to a
Q80: Calling signalAll without locking the object is
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