import java.net.*;
import java.util.*;
class Ip
{
public static void main(String args[])
{
try{
Scanner sc=new Scanner(System.in);
System.out.println("Enter the url");
String url=sc.next();
//String url=args[0]; //By Command line
InetAddress i=InetAddress.getByName(url);
System.out.println("Host address:" +i.getHostAddress());
System.out.println("Host name :"+i.getHostName());
}
catch(Exception e)
{}
}
}
import java.util.*;
class Ip
{
public static void main(String args[])
{
try{
Scanner sc=new Scanner(System.in);
System.out.println("Enter the url");
String url=sc.next();
//String url=args[0]; //By Command line
InetAddress i=InetAddress.getByName(url);
System.out.println("Host address:" +i.getHostAddress());
System.out.println("Host name :"+i.getHostName());
}
catch(Exception e)
{}
}
}
No comments:
Post a Comment