Wednesday 15 July 2015

Find Host IP Address and Host name

  
         
import java.net.InetAddress;

public class FindhostInfo {

    public static void main(String[] args) throws Exception {
        InetAddress addr = InetAddress.getLocalHost();
        System.out.println("Local Host Address:" + addr.getHostAddress());
        System.out.println("Local Host Address:" + addr.getHostName());
    }
} 
        
  

1 comment: