packagetheatre;importjava.io.DataOutputStream;importjava.io.IOException;importjava.net.Socket;publicclassServerThreadextendsThread{privateSocketconnectionSocket=null;privateReservationsreservations;privateDataOutputStreamoutToClient;// the constructor argument is an established socketpublicServerThread(Sockets,Reservationsreservations){this.reservations=reservations;connectionSocket=s;try{outToClient=newDataOutputStream(connectionSocket.getOutputStream());}catch(IOExceptione){e.printStackTrace();}}publicvoidrun(){try{outToClient.writeBytes(this.reservations.buyTicket()+"\n");connectionSocket.close();}catch(IOExceptione){e.printStackTrace();}}}