class useThread extends Thread
class useThread implements Runnable
Threads are a flow of execution. All programs use threads, and you have already constructed a progam that uses a single thread. However, multi threading is more complex. In this section, you will learn why and when to use threads, and, of course, how. The threading concept is pretty easy to understand, and so it should not take too long.
If you create a thread, you need to have 2 classes where one is using the other. To take advantage of threads, the two classes must be able to run at exactly the same time. This simultaneous execution is called concurrency.
For example, you have a networked server application with multiple clients. If you use the Input.getUTF() method, the server has to wait until the client has sent data and the method returns. However, no other client can be serviced, even if other clients have sent data, while your program is waiting for the method to return.