I have a client-server program using socket on the server side and read and write is happening in that way
soc = serversocket.accept();
System.out.println(\"Acce
It's not a deadlock, just bad code. You keep calling readUTF() and then throwing the result away and calling it again, as though the same thing was being sent as many times as you are calling it, which it isn't. So you are blocking, in the redundant calls to readUTF().
So don't do that. Call it once and store the result in a variable.
And it will never return null. Check the Javadoc.
Its a deadlock, you must create and flush the ObjectOutputStream first. This is because ObjectInputStream reads the header sent by the OOS before continuing.