// 实现接口 class MonkeyHair implements Runnable { private final String name; private Thread thread; MonkeyHair(String name) { this.name = name; } @Override public void run() { System.out.println("线程" + name + "运行开始"); try { Thread.sleep(10); } catch (InterruptedException e) { System.out.println("Thread " + name + "运行异常" + e.getMessage()); } System.out.println("线程" + name + "运行结束"); } public void start() { System.out.println(name + "线程开始启动"); if (thread == null) { thread = new Thread(this, name); thread.start(); } } } // 具体调用 MonkeyHair m1 = new MonkeyHair("猴子1"); MonkeyHair m2 = new MonkeyHair("猴子2"); MonkeyHair m3 = new MonkeyHair("猴子3"); m1.start(); m2.start(); m3.start();