Basic Java Threads Java provides classes and methods to create multiple threads inside your Java process. This allows you to run multiple different pieces of code at the same time. In the code below each of the worker threads prints out that they have started, wait a random amount of time before printing their message, wait another random amount of time and print that they have stopped. Each time the program runs the output will be in a different order.
Logging with Java When writing applications in Java it is incredibly useful to print out information as you go a long so that you can track what your application is doing and the state of various different variables. One method of doing this is to use print statements, however, when it comes time to package your code into an application, you have to track down and delete/comment out all of these print statements.