
while(true)...{
synchronized(obj)...{
if(tickets>0)...{
try...{
Thread.sleep(10);
}catch(Exception e)...{
e.printStackTrace();
}
System.out.println(Thread.currentThread().getName()+" sell ticket "+tickets);
tickets--;
}
}
}

