日期:2014-05-20 浏览次数:20794 次
/*测试本地主机IP地址*/ import java.net.*; public class WhoAmI { public static void main(String[]args)throws Exception { try { InetAddress ia=InetAddress.getByName(args[0]); System.out.println(ia); }catch(UnknownHostException e) { System.out.println(e.getMessage()); } } }