Originally posted by Shiva Mohan:
System.out.println(i+3);-------------for this line 23 is printed.
T2.start() will start the t2 thread.so go to execute the run() method. Within that method, (i+1)24 is printed.Then I don�t know how the execution goes?Help me?
Originally posted by Naseem Khan:
After outputing 23 and 24, t2 is returned and now inner createThread will point to t2.
Then after that Outer createThread method gets executed prints 13 (10+3) and 14.
Naseem
SCJP 5
Originally posted by Shiva Mohan:
Thank you very much Naseem.I got it.But���
When I print the thread name I got
code:
--------------------------------------------------------------------------------
23241321Thread[Thread-0,5,main]142211Thread[Thread-1,5,main]12
--------------------------------------------------------------------------------
It started from Thread-0 not from main.Why?
Originally posted by Anthony Karta:
Hi Naseem,
I know the output is correct if we run it.
How do you know for sure first thread won't print 21 first then 13 and 14??
thanks
anthony
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |