packagemultithread;importjava.io.*;importjava.net.*;publicclassServerThreadextendsThread{privateSocketconnectionSocket=null;privateBufferedReaderinFromClient;privateDataOutputStreamoutToClient;// the constructor argument is an established socketpublicServerThread(Sockets){connectionSocket=s;try{inFromClient=newBufferedReader(newInputStreamReader(connectionSocket.getInputStream()));outToClient=newDataOutputStream(connectionSocket.getOutputStream());}catch(IOExceptione){e.printStackTrace();}}publicvoidrun(){StringclientSentence;StringcapitalizedSentence;try{clientSentence=inFromClient.readLine();capitalizedSentence=clientSentence.toUpperCase()+'\n';outToClient.writeBytes(capitalizedSentence);connectionSocket.close();}catch(IOExceptione){e.printStackTrace();}}}