In this exercise, you will become familiar with the concepts of multithreading by writing a multithreaded program.
Using a text editor, create the
- Declare the PrintMe class. This class must implement the Runnable interface.
Crate the run method to loop the following 10 times. Print the name of the current thread and then sleep for 2 seconds.
Using a text editor, create the TestThreeThreads program. In the main method create three threads using the
main method.
- Declare the TestThreeThreads class.
Crate the
Create three thread objects and pass an instance of the PrintName class each constructor.
Give each thread a unique name using the setName method.
Start each thread.
On the command line, use the
On the command line, use the java command to run the test program. You should see output similar to that shown in "Task 4 - Running the