CIS 218 Course Materials
Source File Description
  
ThreadMethods.java This class demonstrates some of the utility methods present in the java.lang.Thread class, as well as makes explicit the execution of multiple threads even in "single-threaded" applications.
  
DemoThreadsA.java This class is a simple example of one way to create a thread in Java - simply extend java.lang.Thread and put the code you want to execute in the public void run() method.
  
DemoThreadsB.java This class demonstrates the second way to create a thread in Java - implement the java.lang.Runnable interface and pass your class to the constructor of a Thread object. As with extending java.lang.Thread, you put the code you want to run in the public void run() method. This example also looks at thread priority and how it can affect the order of thread execution.
  
MoreThreads.java aka DemoThreads2.java The second example in our discussion of basic threadings principles. This example introduces the java.lang.Runnable interface, and the concept of joining threads.
  
SelfJoin.java This class investigates the question: What would happed if I were a Thread an attempted to join with myself?
  
ArrayOfSize10.java This class demonstrates using the synchronized keyword in Java to prevent multiple threads for changing the same data simultaneously
SharedQueue.java This class demonstrates the wait and notify keywords in Java to synchronize producers and consumers.
ProducerConsumer.java This class uses the SharedQueue to demonstrate coordinated message-oriented 1:Many producers<->consumers
Back to Current Session | Web Publishing | Faculty Directory | Maps and Directions | Search
Copyright © 1997 College of DuPage
Computer Information Systems
(630) 942-2800 x51902
goodacrc@cdnet.cod.edu
Updated 10 Jul 2003
Disclaimer