public class MultThread extends Thread{
String name;
//初始化name变量
public MultThread(String name){
this.name=name;
}
//线程
public void run(){
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
System.out.println("Interrupt exception");
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("thread name: "+name);
}
/**
 * @param args
 */
public static void main(String[] args) {
// TODO Autgenerated method stub
//创建多个线程
MultThread mt1=new MultThread("one");
MultThread mt2=new MultThread("two");
MultThread mt3=new MultThread("three");
mt1.start();
mt2.start();
mt3.start();
}
}
输出结果是thread name: one
thread name: three
thread name: two
难道不应该输出,one two three么