package ba;

public class Tongbu implements Runnable{
	int i=100;
	
	public void run(){
		while(true){
			sell();
		}
	}
	
	public synchronized void sell(){
		if(i>0){
			System.out.println(Thread.currentThread().getName()+":"+i);
			i--;
		}
	}

}

 

相关文章:

  • 2021-11-20
  • 2021-11-17
  • 2022-02-07
  • 2021-12-05
  • 2021-07-06
  • 2021-08-30
  • 2021-06-07
  • 2022-03-03
猜你喜欢
  • 2021-11-07
  • 2021-05-31
  • 2021-06-02
  • 2021-06-21
  • 2022-12-23
  • 2022-02-15
  • 2022-12-23
相关资源
相似解决方案