class mythread implements Runnable {
Thread t1;
String name = \"\";
public mythread(String thname) {
name = thname;
t1= new Thread(th
Threads are given processor time or scheduled at the OS level. So your program doesn't have direct control over the times when instructions are executed across its own threads. So there is now guarantee of order. There are a handful of OS specific variables that go into scheduling.
If you want to guarantee order across threads than your threads need to communicate that. There are a handful of ways to do this. Most commonly programmers use a mutex; which is also called a lock.