Class UnknownHostException in Java

digitization, transformation, binary

Class UnknownHostException in Java

UnknownHostException is thrown from an application to indicate that the IP address of the host could not be determined like that hostname does not match with any of the known hosts.

In short, it signals that the name of a specified host could not be resolved to an IP address.

Ads code goes here

A great example is shown on my socket page.

The class structure of UnknownHostException is written below:


public class java.io.UnknownHostException extends java.lang.IOException{
//constructor
public UnknownHostException();
//constructs an empty UnknownHostException object that is an object with no message specified.
public UnknownHostException(String message);
//constructs an UnknownHostException object with the message specified which should be the hostname that cannot be resolved..
}

The class UnknownHostException also inherits methods from class Object and Throwable.

From Object classFrom Throwable class
clone()fillInStackTrace()
getClass()getMessage()
notify()printStackTrace()
wait()printStackTrace(PrintWriter)
wait(long, int)getLocalizedMessage()
wait(long)printStackTrace(PrintStream)
equals(Object)
toString()
finalize()
hashCode()
notifyAll()

Share and Enjoy !

Leave a Comment

Your email address will not be published. Required fields are marked *