It’s not guaranteed that thread mythread will start before thread myrunnable it depends upon Thread scheduler.Thread mythread = new MyThread(); //Thread created not started
mythread.setName("T1");
Thread myrunnable = new Thread(new MyRunnable(),"T2");
mythread.start(); //Thread started now but not running
myrunnable.start();