Thursday, 9 February 2017

Networking : InetAddress






public class InetAddressClass {

    public static void main(String[] args){
        try{
            InetAddress ip=InetAddress.getByName("www.javatpoint.com");
            System.out.println("Host Name: "+ip.getHostName());            System.out.println("IP Address: "+ip.getHostAddress());            System.out.println("IP Address: "+ip.getClass());
        }catch(Exception e){System.out.println(e);}
    }
}

No comments:

Post a Comment