Saturday, June 20, 2020

Get IP Address of any website using Java Code

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

Write a program in python which determine determines that the number is prime or not. What is your favorite number?

Write a program in python which determine determines that the number is prime or not. What is your favorite number? Code   number = int(inpu...