关于线程的-----为什么没有任何输出结果?

one_bird 2004-12-25 10:51:16
1. public class A extends Thread {
2. A() {
3. setDaemon(true);
4. }
310 - 035
Leading the way in IT testing and certification tools, www.testking.com
-60 -
5.
6. public void run() {
7. (new B()).start();
8. try {
9. Thread.sleep(60000);
10. } catch (InterruptedException x) {}
11. System.out.println(“A done”);
12. }
13.
14. class B extends Thread {
15. public void run() {
16. try {
17. Thread.sleep(60000);
18. } catch (InterruptedException x) {}
19. System.out.println(“B done”);
21. }
22. }
23.
24. public static void main(String[] args) {
25. (new A()).start();
26. }
27. }
...全文
118 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
treeroot 2004-12-26
  • 打赏
  • 举报
回复
程序都退出了,还执行什么呀
fdm_sea 2004-12-26
  • 打赏
  • 举报
回复
楼主应该先看看守护进程的定义..
one_bird 2004-12-25
  • 打赏
  • 举报
回复
因为A是守护进程 他也要执行呀
fireflyqt 2004-12-25
  • 打赏
  • 举报
回复
原来是个广告贴!
fdm_sea 2004-12-25
  • 打赏
  • 举报
回复
因为A是守护进程,而main线程结束的太快,所以没有输出

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧