CodesJava

Easy learning with example program codes

Get ip address of host in java

Get ip address of host in java

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

Output

107.180.2.128
Please follow and like us:
error








Copyright © 2019 CodesJava DMCA.com Protection Status