Hi Barry
quote:
___________________________________________________________________________
You are not using threads as they are meant to be used so spending effort to explain this behaviour is not worthwhile (especially because it's easier to use threads the correct way.)
___________________________________________________________________________
Lets take a look at one of the questions from Marcus Greens mock exam.
31)What will happen when you attempt to compile and run the following code?
1) Compile time error
2) Output of first0, second0, first0, second1
3) Output of first0, first1, second0, second1
4) Runtime error
The Ans is 3)Output of first0, first1, second0, second1
In this question he has subclassed a thread class,invoked the start() method,made the Thread to sleep but instead of overriding the run() method he has overridden the start() method.So this actually is not a Thread.Here Threads are not used the right way.But it is not surprising to get such questions in the exam.You tend to get stuck here.
(Code formatted)
[ November 08, 2004: Message edited by: Barry Gaunt ]