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();