Java Example Programs – Find IP Address of any host Using Java

find-ip-address-of-any-host-using-java

Hi, Welcome to Practice House. In this post, we will learn how to find an IP address of your computer that you are using and also what is the hostname of this computer by writing a java program.

It’s a simple Java Program. We use java.net.InetAddress class to find out an IP address for any hostname. it could your website or your computer.

Below we showed you two example of using java.net.InetAddress Class

Find IP Address and Hostname of Your Computer

Sample Output:

 

In Java using InetAddress Class, We can find out any domains IP address by writing a very simple program.
The below java.net.InetAddress Example is showing how to get the IP address of facebook.com.

Find the IP Address for the Domains / Websites

Sample output:

Download the Project

DOWNLOAD THIS JAVA EXAMPLE PROGRAM

Conclusion

Congratulations, now you can write a java program to find out the IP address of any computer and for any other websites. So share with your friends how you learn and teach them also.

Leave a Reply

avatar
  Subscribe  
Notify of