first of all, is there any chance that this program will ouput the line "A Hello!"? I always got "B Hello!".
if it'll never print "A Hello!", could anybody explain why?
thanks
David Spades wrote:
first of all, is there any chance that this program will ouput the line "A Hello!"? I always got "B Hello!".
if it'll never print "A Hello!", could anybody explain why?
Scheduling of threads is not defined by the JVM specification. This is mainly to allow the native threading system to schedule threads as they like. This is also true with the use of condition variables (ie. wait/notify).
So, to answer your question... The behavior is not defined.
David Spades wrote:
first of all, is there any chance that this program will ouput the line "A Hello!"? I always got "B Hello!".
if it'll never print "A Hello!", could anybody explain why?
thanks
David ,
When I'm running your code am getting below output :
List is empty...
List is empty...
Opening...
Interrupted Exception!
New Element:'Hello!'
notifyAll called!
Closing...
Interrupted Exception!
Your code it is quite self explanatory ..
If I modify the code like this
then I get :
List is empty...
Interrupted Exception!
Opening...
New Element:'Hello!'
notifyAll called!
Closing...
A Hello!
Thanks ,
Satya
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.