public class ThreadMain
{
public static void main(String[] args)
{
Thread1 t1 = new Thread1();
t1.start();
System.out.println("I'm from threadMain");
System.out.println("wait for 5 seconds");
try
{
Thread.sleep(5000);
}
catch (Exception e)
{
e.printStackTrace();
}
System.out.println("threadMain comes back");
}
}
public class Thread1 extends Thread
{
public void run()
{
System.out.println("I'm from thread1");
}
}
为什么我的执行结果是: I'm from threadMain I'm from thread1 wait for 5 seconds threadMain comes back