class test{
public static void main(String[] str){
NewThread t = new NewThread();
System.out.println("Main Thread");
}
}//end of class test
class NewThread{
Thread t;
public NewTrhead(){
t = new Thread();
t.star();
}
void run(){
print("child thread");
}
}//end of class NewThread==========================
为什么main thread先于child thread被打印出来?
public static void main(String[] str){
NewThread t = new NewThread();
System.out.println("Main Thread");
}
}//end of class test
class NewThread{
Thread t;
public NewTrhead(){
t = new Thread();
t.star();
}
void run(){
print("child thread");
}
}//end of class NewThread==========================
为什么main thread先于child thread被打印出来?
t.start();
t.join();这样就好了
错了吧!!!根本不是这原因 这跟线程的调度有关系。。