Multiple choice

In Java networking, when a client socket cannot find a server, which of the following exceptions is thrown?

  1. Java.net.BindException

  2. Java.net.UnknownHostException

  3. Java.net.ServerNotFoundException

  4. Java.net.UnknownServerException

  5. Java.net.NoServerFoundException

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

The syntax to create a socket by client to find a server is: Socket s1 = new Socket(“server name”,portnumber);