Java InetAddress toString() methodThe toString() method of Java InetAddress class converts this IP address to a String .The string returned is of the form: hostname/ literal IP address. If the host name is unresolved, no reserve name service lookup is performed. Syntax:OverridestoString () method in class Object ReturnsThe toString() method returns a string representation of this IP address. Example 1Test it NowOutput: 1. www.javatpoint.com/195.201.10.8 2. www.google.com/216.58.200.132 Example 2Test it NowOutput: 1. WWW.JAVATPOINT.COM/195.201.10.8 2. WWW.GOOGLE.COM/216.58.200.132
Next TopicInetAddress Class
|