线程
2015-08-25 22:58
363 查看
MyThread mt=new MyThread();
//线程一启动,就会调用线程类的run()
mt.start();
// InterThread it=new InterThread();
// new Thread(it).start();
//以Runnable为实现类对象参数,意味着当前线程一启动,就会调用Runnable实现类的run()
Thread t=new Thread(new InterThread());
t.start();
for(int i=0;i<10;i++){
System.out.println(i);
try {
//当线程休眠500毫秒后继续执行
Thread.sleep(500);
} catch (Exception e) {
e.printStackTrace();
}
}
//线程一启动,就会调用线程类的run()
mt.start();
// InterThread it=new InterThread();
// new Thread(it).start();
//以Runnable为实现类对象参数,意味着当前线程一启动,就会调用Runnable实现类的run()
Thread t=new Thread(new InterThread());
t.start();
for(int i=0;i<10;i++){
System.out.println(i);
try {
//当线程休眠500毫秒后继续执行
Thread.sleep(500);
} catch (Exception e) {
e.printStackTrace();
}
}
相关文章推荐
- 我走向夜
- subprocessing在python中的应用
- 准备准备..
- 互斥的实例和使用场景
- 1.大数据基础(上)_3.大数据处理技术
- pat(B) 1027. 打印沙漏(输入输出)
- javadoc中文档注释标记的使用
- PreTranslateMessage DoModal() ASSERT(::IsWindow(m_hWnd)
- [学习笔记]线性表的链式存储
- [leetcode] 117.Populating Next Right Pointers in Each Node II
- [LeedCode OJ]#48 Rotate Image
- UVA - 658 It's not a Bug, it's a Feature! (隐式图的最短路,位运算)
- TCP/IP协议
- stack 的入门
- python_学习笔记0825
- iphone开发之UIButton按钮的使用(二)拖线实现 多个按钮用同一个监听方法实现
- group by cube 用法
- git 学习
- hdoj 1698 Just a Hook【线段树区间修改】
- php微信开发 (获取用户地理位置)