package com.task30;
import java.net.*;
public class getAddressIP {
public static void main(String[] args) {
try{
address=InetAddress.getByName("www.163.com");
System.out.println(address.toString());
String domain_name=address.getHostName();
System.out.println("域名为:"+domain_name);
String IP_name=address.getHostAddress();
System.out.println("IP为:"+IP_name);
}catch(UnknownHostException e){
System.out.println("无法找到WWW.163.COM");
}
}
}
噼喱啪啦
相关分类