public class ThreadDemo1 {
public static void main(String[]args){
TestThread tt=new TestThread();
new Thread(tt).start();
new Thread(tt).start();
}
}
class TestThread implements Runnable{
int tickets=100;
public void run(){
while(true){
if(tickets>0){
try{Thread.sleep(1);}catch(Exception e){};
System.out.println("run:"+Thread.currentThread().getName()+"-----is sailing ticket"+tickets--);
}
}
}
}