Multiple choice

Which of the following exceptions is thrown by the Java compiler when we try to create a server socket on a port which is busy?

  1. Java.net.BindException

  2. Java.net.BusyPortException

  3. Java.net.UnknownHostException

  4. Java.net.PortNotFoundException

  5. Java.net.PortBusyException

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In Java network programming, the server creates a server socket on which it listens to the connections of the client. The syntax to create a server socket is: ServerSocket objectname = new ServerSocket(port);