ThreadTest求教!!这是为什么啊?
来源:互联网 发布:电商美工设计 编辑:程序博客网 时间:2024/05/01 06:47
import java.util.Date;
public class TheardTest{//为什么结束不了???
public static void main(String[] args) {
Runner2 f=new Runner2();
f.run();
Thread d=new Thread(f);
d.start();
try{
System.out.println("主线程执行");
Thread.sleep(1000);
}catch(InterruptedException es){
d.interrupt();
}
}
}
class Runner2 implements Runnable{
public void run(){
boolean fig=false;
while(fig){
System.out.println("...."+ new Date()+"....");
try{
Thread.sleep(1000);
}catch(InterruptedException es){
System.out.println("子线程被中断");
return;
}
}
}
}
public class TheardTest{//为什么结束不了???
public static void main(String[] args) {
Runner2 f=new Runner2();
f.run();
Thread d=new Thread(f);
d.start();
try{
System.out.println("主线程执行");
Thread.sleep(1000);
}catch(InterruptedException es){
d.interrupt();
}
}
}
class Runner2 implements Runnable{
public void run(){
boolean fig=false;
while(fig){
System.out.println("...."+ new Date()+"....");
try{
Thread.sleep(1000);
}catch(InterruptedException es){
System.out.println("子线程被中断");
return;
}
}
}
}
- ThreadTest求教!!这是为什么啊?
- 这是为什么啊
- 【zz】求教:为什么这一小段程序不能运行,想不通啊!
- 每个线程调用的是同一个ThreadTest对象
- 求教啊
- 求教啊!!!!
- CSDN,这是为什么?
- 这是为什么呢?
- 这是为什么呢?
- 这是为什么呢?
- 这是为什么?谢谢
- 这是为什么呢?
- 这是为什么呢?
- 这是为什么
- 这是为什么呢??
- 这是为什么
- 这是为什么呢?
- 这是为什么?
- html常用小技巧
- [乐意黎原创] 地铁和轻轨的区别, 中国目前有几个城市有地铁
- 数据库安装及数据库问题解决(六)
- FLEX拖拽实现及介绍
- Google C++ unit test 在ARM Android 2.3 上的编译与使用
- ThreadTest求教!!这是为什么啊?
- 软件调试安装问题汇总
- java中的字符集的编码
- SQL查询效率
- 关于RegisterClass的注册位置
- 对象复制和对象赋值的区别
- Flex组件生命周期
- thinkphp3.0 数据查询
- 进程相关