public static void main(String[] args) throws Exception {
//address是IP的对象,也是一台电脑的对象
InetAddress address = InetAddress.getByName("172.18.153.251");
System.out.println(address.getHostName());
System.out.println(address.getHostAddress());
}
Java基础 InetAddress
发布时间 2023-10-29 20:12:31作者: 嘎嘎鸭2