package pkg9.pkg14;
class MyThread implements Runnable{
public void run(){
int t = 0;
int i = 1;
while(true){
System.out.println("i =" + i);
i++;
}
}
}
public class Main {
public static void main(String[] args) {
MyThread mt = new MyThread();
Thread t = new Thread(mt,"Thread - A");
t.setDaemon(true); //設定在背景執行
t.start();
}
}
文章標籤
全站熱搜