CS3340:  Intro OOP and Design

Threads Exercise

due not turned in

Create a class called SimpleThread that extends the Thread class and in its run method cylces through a loop 10 times and each time prints out the name of the object followed by the clock time (see System, Date and Calendar classes), and follows this printing operation by a call to sleep for 1 second.

Next create a Java Application that creates 3 instances of SimpleThread and then runs each of them.

Change the code by altering the priority of some of the Threads. What happens?

© Lynne Grewe