线程问题

[复制链接]
查看11 | 回复5 | 2009-1-4 14:52:28 | 显示全部楼层 |阅读模式
public class a extends Thread{
a(){

setDaemon(true);

}

public void run(){

(new b()).start();

try{

Thread.sleep(60000);

}catch(InterruptedException x){}

System.out.println("A done&quot

;


}

class b extends Thread
{

public void run(){

try{

Thread.sleep(60000);

}catch(InterruptedException x){}

System.out.println("B done&quot

;

}



}

public static void main(String[] as){

(new a()).start();

}
}
--------------------------------------------------------------------------------------------------
setDaemon(true); 的作用是什么,
回复

使用道具 举报

千问 | 2009-1-4 14:52:28 | 显示全部楼层
setDaemon(true); 标记该线程是后台驻留线程
回复

使用道具 举报

千问 | 2009-1-4 14:52:28 | 显示全部楼层
为什么运行后什么输出都没有
回复

使用道具 举报

千问 | 2009-1-4 14:52:28 | 显示全部楼层
本来就没什么输出嘛
回复

使用道具 举报

千问 | 2009-1-4 14:52:28 | 显示全部楼层
不是有
System.out.println("A done&quot

;
System.out.println("B done&quot

;
这两句吗?
回复

使用道具 举报

千问 | 2009-1-4 14:52:28 | 显示全部楼层
最初由 xiao_cai 发布
[B]不是有
System.out.println("A done&quot

;
System.out.println("B done&quot

;
这两句吗? [/B]

能运行到哪里吗
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行