OO Programming in Java
Threads
Threads are one of the most important features of Java.
Threads are connected to a 'target' whose 'run' method is executed when start() is sent to the Thread.
Java allows methods to be 'synchronized' to prevent multiple threads from accessing the same method in the same object simultaneously.
Don't use bare 'Thread' objects. Design a functional Object model then add threads to the appropriate objects.
Look at the example project below. The GraphTest spawns two Analyzer objects. Each Analyzer object performs its functions in its own thread. The Analyzer object is typical of objects with threads.
Object Model
Scenario Diagram
Code