public class TestThreadviaClassThread {
public static void main(String[] args) {
SubThread sthr = new SubThread();
sthr.start();
for(int i = 0; i < 100; i++){
System.out.println("MainThread" + i);
}
}
}
class SubThread extends Thread{
public void run(){
for(int i = 0; i < 100; i++){
System.out.print("SubThread----" + i);
}
}
}
Toy Program 基础线程入门 via “extends Thread”
最新推荐文章于 2021-06-10 19:27:45 发布