线程的start()方法可以开启线程并与主线程同时进行
public class TestThread01 extends Thread {
@Override
public void run() {
//run方法 线程体
for (int i = 0; i < 10; i++) {
System.out.println("我在玩CSGO第"+ i +"局");
}
}
public static void main(String[] args) {
//main线程 主线程
//创建一个线程对象
TestThread01 testThread01 = new TestThread01();
//开启线程
testThread01.start();
for (int i = 0; i < 3000; i++) {
System.out.println("我在玩彩虹六号第"+ i +"局");
}
}
}