黑马程序员技术交流社区
标题:
线程执行问题
[打印本页]
作者:
王睿
时间:
2012-3-2 23:49
标题:
线程执行问题
为什么执行结果不是两个线程一起执行啊?
new Thread(
new Runnable(){
public void run(){
while(true){
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("Runnable"+Thread.currentThread().getName());
}
}
}
){
public void run(){
while(true){
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("子类"+Thread.currentThread().getName());
}
}
}.start();
}
}
复制代码
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2