概述
线程,进程
Process进程
Thread线程
进程是执行程序的一次执行过程,是系统分配资源的单位,一个进程可以有多个线程,至少有一个线程

第一种方法:继承Thread类
public class TestThread1 extends Thread{
@Override
public void run(){
//run方法线程体
for (int i = 0;i<200;i++){
System.out.println("我在看代码---");
}
}
public static void main(String[] args){
//main线程,主线程
//创建一个线程对象
TestThread1 testThread1 = new TestThread1();
//调用start()方法开启线程
testThread1.start();
for(int i = 0;i<1000;i++){
System.out.println("我在学习多线程---")
}
}
}
并行交替运行

浙公网安备 33010602011771号