package edu.mama.ls18.homework;
/*
乌龟
*/
_public class TortoiseRunnable implements Runnable{
private Race race;
public TortoiseRunnable(Race race) {
if (race == null) {
throw new IllegalArgumentException(“race不能为null”);
}
this.race = race;
}
@Override
public void run() {
while(race.isPlaying){
race.tortoiseDistance+=1;
System._out.println(“乌龟:爬”);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}