【JAVA线程】请教小程序,非常感谢!!问题:为啥这里含有run的语句没有顺序执行?
public class Exa_01 {
public static void main(String[] args){
System.out.println("hello there");
Mushroom a=new Mushroom();
a.start();
System.out.println("end");
}
}
----------------------------------------------
public class Mushroom extends Thread{
private int num;
public void run(){
System.out.println("are you happy?");
}
}
===================================
结果:
hello there
end
are you happy?
这是为什么呢???为什么end与are you happy 输出的顺序相反了呢??
不应该顺序执行吗???
谢谢!!!