Javatpoint Logo
Javatpoint Logo

Java InetAddress getCanonicalHostName() method

The getCanonicalHostName() method of java InetAddress class returns the fully qualified domain name for this IP address, that means we may not be able to return FQDN depending on underlying system configuration.

Syntax:

Returns

It returns the fully qualified domain name for this IP address, or if the operation is not allowed by the security check, the textual representation of the IP address.

Example 1

Test it Now

Output:

 127.0.0.1

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