CS401| software engineering
  • outline
  • projects
  • syllabus
  • links

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?

 

cs401:software engineering

  • home
  • outline
  • projects
  • syllabus
  • links