Explore BrainMass

Java Class using Thread

Create a class named RaceHorse that extends Thread. Each RaceHorse has a name and a run() method that displays the name 50 times. Write an application that instantiates 5 RaceHorse objects each with different names, executing in their own Thread. The last RaceHorse to finish is the loser. Save the files as and

Solution Preview

You can do something like following.

public class RaceHorse extends Thread {

private String name;

public RaceHorse(String name) {