📄 daemonthread.java
字号:
/*
* DaemonThread.java
*
* Created on 2007年11月13日, 下午8:49
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package org.Adam;
/**
*
* @author Administrator
*/
public class DaemonThread {
/** Creates a new instance of DaemonThread */
public DaemonThread() {
}
public static void main(String[] args) {
TestThread t=new TestThread();
Thread tt=new Thread(t);
tt.setDaemon(true);
tt.start();
try {
tt.sleep(5000);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
}
class TestThread implements Runnable{
public void run(){
while(true){
System.out.println(Thread.currentThread().getName()+" is running.");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -