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");
//도메인 이름
System.out.println("Yahoo 서버 주소 = "+
ServerAddress.getHostName());
//야후 서버 IP 주소
System.out.println("도메인 이름 = "+
ServerAddress.getHostName());
System.out.println("서버의 IP 주소 Yahoo.com = "+
ServerAddress.getHostAddress());
System.out.println("서버의 IP 주소 Yahoo.fr = "+
InetAddress.getByName("www.yahoo.fr").getHostAddress());
} catch (UnknownHostException e) {
e.printStackTrace();
}
}
}
domain name = www.yahoo.comgetHostName(): 이 IP 주소의 시스템 이름을 반환합니다.
서버의 IP 주소 Yahoo.com = 46.228.47.115
서버의 IP 주소 Yahoo.fr = 77.238.184.150
Please disable your ad blocker and refresh the window to use this website.