Skip to content

Instantly share code, notes, and snippets.

@shihyu
Created April 23, 2015 08:28
Show Gist options
  • Save shihyu/7cc50d0fa9aff7cbffa4 to your computer and use it in GitHub Desktop.
Save shihyu/7cc50d0fa9aff7cbffa4 to your computer and use it in GitHub Desktop.
 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--);
  
}
  
}
  
}
  
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment