p { margin-bottom: 0.21cm; }
定义方式
class TestThead implements Runnable /*extends Thread */ {
public void run() {
int index = 0;
while ( true ) {
System. out .println( "run()" +Thread. currentThread ().getName()+index);
index++;
}
}
}
实例化 使用方式
Thread testThead = new Thread( new TestThead());
testThead.start();
本文介绍了一种通过实现Runnable接口创建多线程的Java程序设计方法,并提供了具体的代码实例。
2546

被折叠的 条评论
为什么被折叠?



