import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class InetAddressInUse {
public static void main(String[] args){
try {
InetAddress ip4 = Inet4Address.getLocalHost();
System.out.println(ip4.getHostAddress());
} catch (UnknownHostException e) {
e.printStackTrace();
}
}
}
Java获取当前ip地址
最新推荐文章于 2024-09-23 09:43:46 发布
关键词由CSDN通过智能技术生成