import java.net.InetAddress;Output:
import java.net.SocketException;
import java.net.UnknownHostException;
public class ServerAddress {
public static void main(String[] zero) throws SocketException {
InetAddress ServerAddress;
try{
ServerAddress= InetAddress.getByName("www.yahoo.fr");
//domain name
System.out.println("Yahoo server address = "+
ServerAddress.getHostName());
//IP-Adresse des Yahoo-Servers
System.out.println("Domainname = "+
ServerAddress.getHostName());
System.out.println("Die IP-Adresse des Servers Yahoo.com = "+
ServerAddress.getHostAddress());
System.out.println("Die IP-Adresse des Servers Yahoo.fr = "+
InetAddress.getByName("www.yahoo.fr").getHostAddress());
} catch (UnknownHostException e) {
e.printStackTrace();
}
}
}
domain name = www.yahoo.comgetHostName(): gibt den Computernamen für diese IP-Adresse zurück.
Die IP-Adresse des Servers Yahoo.com = 46.228.47.115
Die IP-Adresse des Servers Yahoo.fr = 77.238.184.150
Please disable your ad blocker and refresh the window to use this website.