p { margin-bottom: 0.21cm; }
1. 实现多线程方法 继承Thread 类 从写run 方法
class TestThead extends Thread {
@Override
public void run() {
// TODO Auto-generated method stub
while ( true ) {
System. out .println( "run()" +Thread. currentThread ().getName());
super .run();
}
}
}
2. 使用多线程方法
实例化线程对象,调用 Thread 的 strat 方法
new TestThead().start();