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.