devxlogo

InetAddress to String

InetAddress to String

Question:
Is it possible to convert from java.net.InetAddress to string?

Answer:
Yes. Just call the InetAddress toString() method. Also, if you specifically want the host name, use getHostName. If you want a string representation of the IP address, use getHostAddress().

devx-admin

Share the Post: