i have a beginners question:

I have 3 Classes extending Thread. They are doing the same job: open a ServerSocket and then wait for connections in a while loop. The only difference between these classes is, that they start a specific Thread when they have a connection.
I want to simplify this and have one Class doing the job, that atm 3 classes are doing. In the example the only difference is the call of SocketThread1, SocketThread2 and SocketThread3.

How could i make 1 class instead of having 3 of them?

Example:

```
\\class 1

public void run()
{
    while(true)
    {
        Socket s = serversocket.accept();
        new SocketThread1(s).start();
    }}

\\class 2

public void run()
{
    while(true)
    {
        Socket s = serversocket.accept();
        new SocketThread2(s).start();
    }

}

\\class 3

public void run()
{
    while(true)
    {
        Socket s = serversocket.accept();
        new SocketThread3(s).start();
    }

```