You should read the Creating, running, and setting the characteristics of a thread recipe in Chapter 1, Thread Management, to learn the basic mechanism of thread creation in Java. You can compare both the mechanisms and select one, depending on the problem.
The example of this recipe has been implemented using the Eclipse IDE. If you use Eclipse or a different IDE, such as NetBeans, open it and create a new Java project.