为什么我将 IP 地址设置为 127.0.0.1
这是我用于获取 IP 地址的示例程序
package com;
import java.net.InetAddress;
import org.apache.log4j.Logger;
public class Test {
private static final Logger logger = Logger.getLogger(Test.class);
public static void main(String args[]) throws Exception {
String ips = InetAddress.getLocalHost().getHostAddress().trim();
System.out.println(ips);
}
}