class MyThread implements Runnable{
private int ticket =10;
public void run(){
for(int i=0;i<20;i++){
if(this.ticket>0){
System.out.println("卖票 ticket"+this.ticket--);
}
}
}
}
public class RunnableTicket{
public static void main(String[] args){
MyThread mt = new MyThread();
new Thread(mt).start(); //同一个mt,但是在Thread中就不可以,
new Thread(mt).start();
new Thread(mt).start();