import java.util.Scanner;
public class DaemonTest extends Thread {
    public void run(){
    for(int i = 1; i <= 20; i++){
	    try{
	        Thread.sleep(1000);
		} catch (InterruptedException e){
		    System.out.println(e);
		}
		    System.out.println(i);
		}
	}
	public static void main(String [] args){
		DaemonTest test = new DaemonTest();
		test.setDaemon(true);
		test.start();
		System.out.println("isDaemon = " + test.isDaemon());
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		System.out.println(s);
		System.out.println("输入结束，主线程结束，守护线程立刻结束！");
	}
}
