March 29th, 2015, Thread Name is odd by increasing 1
public class Fabric extends Thread{
public static void main(String args[]){
Thread t = new Thread(new Fabric());
Thread t2 = new Thread(new Fabric());
Thread t3 = new Thread(new Fabric());
t.start();
t2.start();
t3.start();
}
public void run(){
System.out.println(Thread.currentThread().getName() + ": " + i);
}
}
这段代码的输出为 1,3,5 (无序)
但如果指定线程名则为1,2,3:
public class Fabric extends Thread{
public static void main(String args[]){
Thread t = new Thread(null, new Fabric(), "1");
Thread t2 = new Thread(null, new Fabric(), "2");
Thread t3 = new Thread(null, new Fabric(), "3");
t.start();
t2.start();
t3.start();
}
public void run(){
System.out.println(Thread.currentThread().getName() + ": " + i);
}
}
March 29th, 2015, Thread Name is odd by increasing 1的更多相关文章
- Microsoft SQL Server Version List [sqlserver 7.0-------sql server 2016]
http://sqlserverbuilds.blogspot.jp/ What version of SQL Server do I have? This unofficial build ch ...
- Git for Windows v2.11.0 Release Notes
homepage faq contribute bugs questions Git for Windows v2.11.0 Release Notes Latest update: December ...
- qml操作播放器
现在增加了一个filter属性,所以可以很好和opencv结合.转一篇文章(http://blog.qt.io/blog/2015/03/20/introducing-video-filters-in ...
- Diagnosing out of memory errors and memory leaks 内存泄露实例 C Java JavaScript 内存泄露
小结: 1. 数据库连接池. JDBC语句和结果对象必须显式地关闭. 2. 电梯到目标楼层后地址是否被释放 When a button is pressed: Get some memory, whi ...
- Spark版本发布历史,及其各版本特性
2016年11月5日 We are proud to announce that Apache Spark won the 2016 CloudSort Benchmark (both Dayto ...
- KBMMW 4.80.00 发布
一大波更新来了. 4.80.00 March 30 2015 Important notes (changes that may break existing code) ======= ...
- Lua的各种资源1
Libraries And Bindings LuaDirectory > LuaAddons > LibrariesAndBindings This is a list of l ...
- Building and running Node.js for Android
转自: http://www.goland.org/nodejsonandroid/ Building and running Node.js for Android October 14, 2014 ...
- Zend Guard Run-time support missing 问题的解决
Zend Guard是目前市面上最成熟的PHP源码加密产品了. 刚好需要对自己的产品进行加密,折腾了一晚上,终于搞定,将碰到的问题及解决方法记录下来,方便日后需要,也可以帮助其他人. 我使用的是Wam ...
随机推荐
- [Angular] Step-By-Step Implementation of a Structural Directive - Learn ViewContainerRef
For example we have two buttons: When we click nether one of those tow button, the modal should show ...
- 30、在LCD上显示摄像头图像
1. 准备虚拟机2.安装工具链sudo tar xjf arm-linux-gcc-4.3.2.tar.bz2 -C /设置环境变量:sudo vi /etc/environment : PATH=& ...
- mysql select 无order by 默认排序 出现乱序的问题
原文:mysql select 无order by 默认排序 出现乱序的问题 版权声明:感谢您的阅读,转载请联系博主QQ3410146603. https://blog.csdn.net/newMan ...
- 《编程导论(Java)·4.1数据抽象的含义》
You have no choice about the necessity to integrateyour observations, your experiences, your knowled ...
- php实现调整数组顺序使奇数位于偶数前面
php实现调整数组顺序使奇数位于偶数前面 一.总结 1.array_push()两个参数,$arr在前 2.array_merge()的返回值是数组 二.php实现调整数组顺序使奇数位于偶数前面 ...
- mysql 查询重复 去除重复等等
查找所有重复标题的记录: SELECT * FROM t_info a WHERE ((SELECT COUNT(*) FROM t_info WHERE Title = a.Title) > ...
- [Angular] Zones and NgZone
NgZone, Angular uses it to profiling all the async actions such as setTimeout, http request and anim ...
- [Angular2 Router] Get activated router url
getActivatedRoutePath(r: ActivatedRoute) { return r.url .subscribe(p => this.curtPath = p[0].path ...
- android环境安装
引言 在windows安装Android的开发环境不简单也说不上算复杂,本文写给第一次想在自己Windows上建立Android开发环境投入Android浪潮的朋友们,为了确保大家能顺利完成开发环 ...
- 打开cad文件的几种方法
转自原文 打开cad文件的几种方法 IWorkspaceFactory pWorkspaceFactory; IFeatureWorkspace pFeatureWorkspace; IFeature ...