previous
|
start
|
next
Scenario to Explain Non-zero Result
The first thread
t0
executes the lines
System.out.print("Depositing " + amount); double newBalance = balance + amount;
t0
reaches the end of its time slice and
t1
gains control
t1
calls the withdraw method which withdraws $100 from the balance variable.
Balance is now -100
t1
goes to sleep
previous
|
start
|
next