用这个方法 public static InetAddress getByName(String host) throws UnknownHostException
其实很多问题去查API文档就可以找到答案了所以我建议大家还是要多多学习如何利用API文档来写程序