import java.net.InetAddress;
import java.net.UnknownHostException;
import java.io.*;
public class IpName {
static public void main(String[] args) {
try {
//通过主机名称得到IP地址
InetAddress address = InetAddress.getByName(args[0]);
System.out.println(args[0]+": "+address.getHostAddress());
//通过IP得到主机名称
/**String ips="192.168.0.",ip;
InetAddress addip;
for(int i=1;i<255;i++){
ip=ips+i;
addip=InetAddress.getByName(ip);
System.out.println(ip+": "+addip.getHostName());
}
**/
}
catch(UnknownHostException uhe) {
System.err.println("Unable to find: "+args[0]);
}
}
}