Java InetAddress getLocalHost() methodThe getLocalHost() method of Java InetAddress class returns the instance of InetAddress containing local host name and address. In this, firstly the host name is retrieved from the system, then that name is resolved into InetAddress. Syntax:ReturnsIt returns the instance of the local host. ThrowsUnknownHostException: if the local host name could not be resolved into an instance. Example 1Test it NowOutput: 10.0.0.4
Next TopicInetAddress Class
|