Get ip address of host in java

Get ip address of host in java

package com.w3spoint;
 
import java.net.InetAddress;
 
public class NetworkTest {
  public static void main(String args[]){
	try {
	    InetAddress host = InetAddress.getByName("w3spoint.com");
            System.out.println(host.getHostAddress());
        } catch(Exception e) {
            e.printStackTrace();
        }
  }
}

Output

107.180.2.128
Content Protection by DMCA.com
Please Share