Using the Runnable Interface In A Server Socket Class
I have a server socket class in my Java server. Right now the socket class does 5 things:
1. Creates an instance of the ServerSocket class with a port and an instance of SocketService
2. It starts
3. It runs
4. It stops
3. It accepts a connection from a client
When start is called on the socket server, an instance of Runnable, called connectionHandler, is created.
You should use Javas' Runnable interface is when building out a class whose instance will be executed by a thread. Runnable requires you to define a method called run. The run method cannot have any arguments.
I like Java interfaces; they put limitations on what you can do and force you to do certain things in order to use them. This gives me a better idea of what direction to head into.













