CoreJava/exp12/Person.java

22 lines
441 B
Java
Raw Normal View History

2024-05-21 17:41:05 +08:00
package exp12;
import exp12.TicketingSystem.TicketingSystem;
public class Person extends Thread{
@Override
public void run() {
while (true) {
try {
Thread.sleep(3);
} catch (InterruptedException e) {
e.printStackTrace();
}
if ( !TicketingSystem.buy(Thread.currentThread().getName())) {
break;
}
}
}
}