hi am doing thread running race
the hare and tortoise timeless running race, but I change the variable from hare to cat and tortoise to dog,
everything seem to going smooth except when it reach where it was interrupted method.
can someone tell men why the compiler is not recognizing this error and how to fix it. here is the code
any help would be greatly appreciately and tell me how to fix it
public class ThreadRace {
public static void main(String[]args){
Thread dog = new Thread(new ThreadRunner("Dog", 0,10));
Thread cat = new Thread(new ThreadRunner("cat", 0, 10));
dog.start();
cat.start();
}
public static void finished(Thread winner){
if(winner.isInterrupted()){
return;
}
if(winner.getName().equals("Dog")){
cat.interrupt(); this is where the error is(cat)
}
else if(winner.getName().equals("Cat")){
dog.interrupt();this is where the error is(dog)
}
}
