1.

What happens if ServerSocket is not able to listen on the specified port?(a) The system exits gracefully with appropriate message(b) The system will wait till port is free(c) IOException is thrown when opening the socket(d) PortOccupiedException is thrown

Answer» The correct answer is (c) IOException is thrown when opening the socket

The best I can explain: public ServerSocket() creates an unbound server socket. It throws IOException if specified port is busy when opening the socket.


Discussion

No Comment Found

Related InterviewSolutions