嗨,我是一名线程新手java程序员。我一直坚持这个简单的Java程序
public class Multi extends Thread{
public void run() {
try{
System.out.println("running...");
}
catch(Exception e){
System.out.print(e);
}
}
public static void main(String[] args){
Multi t1=new Multi();
t1.run();//fine, but does not start a separate call stack
}
}
答案 0 :(得分:2)
答案 1 :(得分:1)
Java 线程由以下方法触发:
t1.start() // This starts a new thread
以下内容:
t1.run();// This calls the run method in the same thread
答案 2 :(得分:1)
答案 3 :(得分:0)
t1.run();// just calls the run method (like any other method) in the same thread.
use t1.start() // starts a new thread.