can any body explain me the flow of this program? What does join() actually do here? Does the static specified for the method 'Joining' makes any change? Because I get different answers if and if not static is present Plz help me...
(I just came up with some kind of a solution based on the output :-). I am not a 100% sure, but I think I am close) So think of it like this: One thing is, the inner method gets executed first. And, I am shortening the name of the method createThread to just "CT", and I am giving the current thread a name, which M (as in main).
Basically, this was the ouput when I ran your program. And please make sure you use the Instant UBB code below when you paste your CODE.
23 24 21 13 14 22 11 12
Hope that helps.
posted 13 years ago
The other answer to your question about being static or not is that, I am a little confused. Basically the createThread method was named static so that you can call it within your main method. If you remove the word 'static', your code would not even compile.