Hi, It may be silly doubt? but please expalin.. What is the difference between Thread.start() and Thread.run(), start() method is internally calling the run().. Can i use run() method directly instead of t.start().. thanks in advance.. Suresh
though thread.start() method internally calls run(), it starts the new Thread. where as if u just call run() method directly it will execute the code with in run method but won't start a new Thread. so there is a difference........Ajit
posted 18 years ago
I am not able to under stand this problem clearly.. can any one explain this..
Which of the follwoing statements are true.. Ans: One cannot be certain whether any of the letters i,j and k will be printed during execution thanks in advance.. regards, Suresh
[This message has been edited by Marilyn deQueiroz (edited October 11, 2001).]
Suresh, The answer is correct If you observe the code, doit(); check(); are one after the other so threads may not have anything to synchronize The only way the output is possible is when check() gets executed inbetween the incrementing code. This creates an uncertainity in the output since it becomes now a OS specific This code may work in solaris as pre-emptive nature in Windoze as RoundRobin nature Therefore the output is unpredictable Ragu
[This message has been edited by Ragu Sivaraman (edited October 11, 2001).]