初始多进程
public class TestThread04 implements Runnable{
private int ticketNums = 10;
public void run(){
while (true){
if(ticketNums<=0){
break;
}
try {
Thread.sleep(200);
}catch (InterruptedException e){
e.printStackTrace();
}
System.out.println(Thread.currentThread().getName()+"-->拿到了第"+ticketNums--+"票");
}
}
public static void main(String[] args) {
TestThread04 testThread04 = new TestThread04();
new Thread(testThread04,"小红").start();
new Thread(testThread04,"小明").start();
new Thread(testThread04,"小李").start();
}
}