Welli'll give it a try.
Beware! i am only a beginner.
I guess your real question is :
Why does the main thread execute first although you start the other two threads first.
As far as i understood you can not tell which thread will execute first.
When you change your program a bit (add a few extra threads)
like:
and you extend the range of the for loops
you will probably see in your output that the order the threads are executed changes.
The why of it all will have to be explained by someone else
Oh and if my answer is wrong please correct me.
good luck
hope it helps a it (probably one of the experts will chime in now)
[EDIT] Look what i found on this site:
JavaRanch thread example [ July 07, 2006: Message edited by: Jan-Jaap van Nieuwkerk ]