Thursday, August 22, 2013

Two threads printing even and odd numbers one after the other

There should be two threads 'ODD' thread and 'EVEN' thread- 'ODD' thread will first print 1 and then will allow the 'EVEN' thread to print 2. 'ODD' thread will then print 3 and the 'EVEN' thread will print 4 and so on -

Code

Output

1 comment: