package com.gxx.threads.study.test5; /** * 工具类 * @author Gxx */ public class Tools { /** * 计数 */ int count = 10; /** * 打印count * @throws Exception */ public synchronized void printCount() { try { count--; /** * 睡眠1秒 */ Thread.sleep(1000); System.out.println("线程[" + Thread.currentThread().getName() + "]执行count=" + count); } catch (InterruptedException e) { e.printStackTrace(); } } }