SWEN-342 Engineering of Concurrent & distributed Software Systems
Thread Introduction
Overview
This is a quick activity to get you into (or back into) programming threads in the Java. You are free to work
with other class members, but everyone must submit his or her own
solution.
Problem Description
Write a Java application (TwoThreadTest.java) that concurrently runs two instances of the thread SimpleThread.java.
Name the two threads "Hi" and "Ho". When started SimpleThread
delays a random period of time between 0 and 1 seconds and then prints
the thread name. The thread repeats this action 10 times and then
stops. For each line printed, also output the number of the iteration
(1-9). On the final iteration print "DONE!" instead of the number.
A sample run of the program would be :
1 Hi
1 Ho
2 Ho
2 Hi
3 Hi
3 Ho
4 Ho
4 Hi
5 Ho
5 Hi
6 Ho
7 Ho
6 Hi
8 Ho
9 Ho
7 Hi
DONE! Ho
8 Hi
9 Hi
DONE! Hi
Deliverables
Submit the two files, SimpleThread.java and TwoThreadTest.java
by placing them in a appropriately named directory and pushing them to your GitHub repo by the end of class.