How to build a high quality Client/Server Java application – a Java Chat Client/Server example Part4

March 20th, 2006

Part1 , Part2 , Part3 , Part4 ,Part5

In the next example we will start 3 threads. Each thread will print a unique string and then go to sleep for set time and then print another string and so on. There are two ways to create a thread: One is to subclass the Thread class the other is to implement “runnable’. I will show you how to do it both ways. Most of the time you want to subclass a thread, but it some situations it is far easier to implement Runnable. For example when you have to pass a great amount of data to the thread class it may be easier to just create the thread in the class you are in.

Extending Thread example

Implementing Runnable example


Java,/client/server,course,chat,sockets,network

3 Responses to 'How to build a high quality Client/Server Java application – a Java Chat Client/Server example Part4'

  1. Great Tasting Java » Blog Archive » How to build a high quality Client/Server Java application - a Java Chat Client/Server example Part3 says:

    March 20th, 2006 at 3:14 pm

    [...] , Part2 , Part3 ,Part4 [...]

  2. Great Tasting Java » Blog Archive » How to build a high quality Client/Server Java application - a Java Chat Client/Server example Part1 says:

    April 5th, 2006 at 12:45 pm

    [...] Part1 , Part2 , Part3 , Part4 ,Part5 [...]

  3. Great Tasting Java » Blog Archive » How to build a high quality Client/Server Java application - a Java Chat Client/Server example Part5 says:

    April 10th, 2006 at 2:38 pm

    [...] Part1 , Part2 , Part3 , Part4 ,Part5 [...]

Leave a Comment