Richard Wilson
Rob
SCJP 1.4
<a href="http://www.rajindery.com" target="_blank" rel="nofollow">Rajinder Yadav</a><p>Each problem that I solved became a rule which served afterwards to solve other problems. --Rene Descartes
Rob
SCJP 1.4
<a href="http://www.rajindery.com" target="_blank" rel="nofollow">Rajinder Yadav</a><p>Each problem that I solved became a rule which served afterwards to solve other problems. --Rene Descartes
Richard Wilson
<a href="http://www.rajindery.com" target="_blank" rel="nofollow">Rajinder Yadav</a><p>Each problem that I solved became a rule which served afterwards to solve other problems. --Rene Descartes
Rob
SCJP 1.4
Originally posted by Rob Ross:
Or also just "vandeleur".
The point is, you can't guarantee anything about thread scheduling, so any of these combinations is perfectly possible.
Richard Wilson
Richard Wilson
Originally posted by Richard Wilson:
We can not decide the time when the thread will be running.But definitely, the thread will run
at sometime,right?
Rob
SCJP 1.4
Originally posted by Rob Ross:
For someone who is disagreeing with me, you sure sound like you're agreeing with me![]()
After method piggy() is invoked, at some point another thread will be spawned, after the start() method has been called. But you cannot predict exactly when that thread will start. It could start *after* main() has ended. Or it could start, run, and complete before piggy() returns control to main(). My point is, you cannot guarantee the order of execution, so therefore you cannot predict what gets printed in this example.
Richard Wilson
Paddy spent all of his days in the O'Furniture back yard with this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|