0
Guys when I try 2 threads instances(for counting upto 10 ) using runnable interface I get output where in t1 is completely executed n then t2 ... While in tutorial t1.10 t2.10 t1.9 t2. 9 t1.8 t1.7 like that
What's the problem
5 Respostas
+ 2
Maybe thread run very quick. Let's try call Thread.sleep(1000);
+ 1
The output of two threads depends on many factors, such as architecture and thread priority. The most important one being the JVM, which gives no guarantee at all about the order of threads. So it is likely that the output of a program running on two threads is different on different computers.
0
okk but I followed the guy of tutorial but we r having different op ?? y is that ?? He n have both have same for loop conditions
0
I'll try that wachirakorn:)
0
@ kerem r u saying that each individual thread is running on separate core that's y the problem is occurring