可以用如下代码:
InetAddress inet = InetAddress.getLocalHost(); System.out.println("本机的ip=" + inet.getHostAddress());
本文地址:http://com.8s8s.com/it/it10407.htm