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 ...
随机推荐
- Vue实现上传图片功能
前言: 用vue实现上传图片功能,效果图如下: 先说文件上传控件样式美化怎么做,我有两种方法. 1.先上代码 html部分: <div class="pics-wrapper" ...
- RISC-V评估系列
RISC-V评估系列 RISC-V工具链搭建 SiFive虚拟机分享--提取码:xe1c SiFive SDK函数结构 底层驱动 driver框架 操作系统FreeRTOS移植 FGPA评估 benc ...
- js私有变量
js私有变量 一.总结 1.在js函数中定义 this.name='张三'; (函数的属性)外部是可以访问的,但是 var name='张三'; (函数的私有变量),这样定义的话外部没有办法访问 2. ...
- Cannot find module "element-ui/lib/theme-default/index.css"——解决办法
在vuejs中使用element-ui 1.安装 cnpm install style-loader --save-dev cnpm install css-loader --save-dev cnp ...
- 【52.49%】【codeforces 556A】Case of the Zeros and Ones
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- JavaScript中的一些细节 分类: C1_HTML/JS/JQUERY 2014-08-05 16:45 384人阅读 评论(0) 收藏
1.设置id / class等属性 用 setAttribute 设置一些常规属性如 id ,className 的时候经常不起作用,只能用 object.id = value 这样来设置 news_ ...
- Objective-C中 ==、isEqual、isEqualToString判断字符串相等
图片发自简书App 在判断一个字符串类型的变量是否与某字符时相等,你可能写下这样一行代码 if (activityType == @"0"){} //activityType是某一 ...
- php面试题6
php面试题6 一.总结 二.php面试题6 写出你认为语言中的高级函数:1)preg_replace()2)preg_match()3) ignore_user_abort()4) debug_ba ...
- [Angular] Auxiliary named router outlets
Define a auxilliary router: export const ROUTES: Routes = [ { path: 'folder/:name', component: MailF ...
- Uncaught SyntaxError: Invalid regular expression flags(看页面源代码)
Uncaught SyntaxError: Invalid regular expression flags(看页面源代码) 一.总结 js或者jquery方面的错误看页面源代码,一下子错误就很清晰了 ...