Javatpoint Logo
Javatpoint Logo

Java InetAddress toString() method

The 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:

Overrides

toString () method in class Object

Returns

The toString() method returns a string representation of this IP address.

Example 1

Test it Now

Output:

1. www.javatpoint.com/195.201.10.8
2. www.google.com/216.58.200.132

Example 2

Test it Now

Output:

1. WWW.JAVATPOINT.COM/195.201.10.8
2. WWW.GOOGLE.COM/216.58.200.132

Next TopicInetAddress Class





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA