Get IP Address of any website using Java Code
import java.net.*;
class IpAddress
{
public static void main(String args[])
{
String site="www.google.com"; // change accordingly
try
{
InetAddress inet= InetAddress.getByName(site);
System.out.println(" IP ADDRESS -- "+inet.getHostAddress());
System.out.println(" HOST NAME -- "+inet.getHostName());
}
catch(Exception ee)
{
System.out.println(" exception "+ee);
}
}
}
Output:
Note- Ensure that your device having internet connection...
No comments:
Post a Comment