1、守护线程伴随着主线程的销毁而销毁;

2、jvm虚拟机中有很多守护线程,随着main函数的结束而结束,自动回收栈中的内容。

Thread t1 = new Thread(){
@Override
public void run() {
for (int i = 0; i < 10; i++) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
ad++;
System.out.println(ad);
}
}
};
t1.setDaemon(true);
t1.start();
Thread.sleep(2000);
System.out.println(ad);

  

最新文章

  1. 基于Dubbo框架构建分布式服务(一)
  2. [Unreal]学习笔记之灯光说明
  3. C#基础知识一之base关键字
  4. 【MySQL】Create table 以及 foreign key 删表顺序考究。
  5. 【Cocos2d-x游戏开发】Cocos2d-x中的弱联网技术
  6. Android 进程常驻----native保活5.0以下方案推演过程以及代码
  7. 数据库和3G的结合使用
  8. [MongDB] 主从架构--官方极力不推荐
  9. C#设计模式(11)——外观模式(Facade Pattern)
  10. javascript继承(一)—类的属性研究
  11. ZooKeeper 安装部署
  12. utf-8转换为ansi和修改文件名的批处理(可解决source insight中文注释乱码问题)
  13. Google DNS劫持背后的技术分析
  14. spring-mvc @Controller 200-不生效
  15. 【20171104中】chrome自动刷新网页
  16. memcpy一种实现方法
  17. js复习--基础
  18. Lombok轮子
  19. python 爬虫-2
  20. Terminating app due to uncaught exception &#39;NSInvalidArgumentException&#39;, reason: &#39;*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]&#39;

热门文章

  1. Cow Exhibition (01背包)
  2. 72.spring boot讨论群【从零开始学Spring Boot】
  3. [luoguP1266] 速度限制(spfa)
  4. Codeforces Round #292 (Div. 2) D. Drazil and Tiles [拓扑排序 dfs]
  5. 转: ORACLE存储过程笔记2----运算符和表达式
  6. 【TFS 2017 CI/CD系列 - 02】-- Build篇
  7. 在Studio中使用Access数据库时,提示“未在本地计算机上注册“Microsoft.ACE.OLEDB.12.0”提供程序”
  8. MySQL 资源大全
  9. Android系统改动时间格式为24小时制
  10. eclipse Alt+/ 不能提示