读书人

P335 实例 15.5 DaemonThread.java 运

发布时间: 2012-09-06 10:37:01 作者: rapoo

P335 范例 15.5 DaemonThread.java 运行结果不唯一?

package onlyfun.caterpillar; public class DaemonThread {     public static void main(String[] args) {        Thread thread = new Thread(        // 这是匿名类的写法            new Runnable() {                public void run() {                     while(true) {                         System.out.print("T");                     }                 }                    });         // 设定为Daemon线程        thread.setDaemon(true);         thread.start();     }}

?java -cp ./classes onlyfun.caterpillar.DaemonThread

读书人网 >编程

热点推荐