// IPAddress of a website
import java.io.*;
import java.net.*;
class Address
{
public static void main(String[]arr)throws IOException
{
// accept name of the website from keybord
BufferedReader br=new BufferedReader(new InputStreamReader(System.in) );
System.out.println("Enter the website name:");
String site= br.readLine();
try{
// getByName() method accepts site name and return its IP address
InetAddress ip=InetAddress.getByName(site);
System.out.println("The IP Address is"+ip);
}
catch(UnknownHostException ue)
{
System.out.println("website not found");
} }
}
import java.io.*;
import java.net.*;
class Address
{
public static void main(String[]arr)throws IOException
{
// accept name of the website from keybord
BufferedReader br=new BufferedReader(new InputStreamReader(System.in) );
System.out.println("Enter the website name:");
String site= br.readLine();
try{
// getByName() method accepts site name and return its IP address
InetAddress ip=InetAddress.getByName(site);
System.out.println("The IP Address is"+ip);
}
catch(UnknownHostException ue)
{
System.out.println("website not found");
} }
}
0 comments:
Post a Comment