Java program to display the IP Address of a particular Host

import java.net.*;
import java.io.*;
public class iphost
{
    public static void main(String args[]) throws Exception
    {
        System.out.println("Enter the host name :");
        String n=new DataInputStream(System.in).readLine();
        InetAddress ipadd =InetAddress.getByName(n);
        System.out.println("IP address :"+ipadd);
    }
}

Comments