Java InetAddress getAllByName() methodThe getAllByName() method of Java InetAddressGiven class returns an array of IP addresses, based on the given host name and the configured name service on the system. If the host is null then the InetAddress representing an address of the loopback interface is returned. Syntax:Parameters:host - the name of host ,or null. ReturnsThe getAllByName() method returns an array of all the IP address for the specified host name. ThrowsUnknownHostException - if no Ip address for the host could be found, or if scope_id was specified for a global IPv6 address. SecurityException - if a security manager exists and its checkConnect method doesn?t allow the operation. Example 1Test it NowOutput: www.javatpoint.com/185.53.178.9 Example 2Test it NowOutput: 1. [Ljava.net.InetAddress;@1540e19d
Next TopicInetAddress Class
|