import java.net.InetAddress;
public class InetTest3 {
public static void main(String[] args)throws Exception {
//创建根据IP地址获取计算机信息的InetAddress对象
InetAddress inetAddress =InetAddress.getByName("192.168.1.107");
//返回IP地址
System.out.println(inetAddress.getHostAddress());
//返回计算机名
System.out.println(inetAddress.getHostName());
}
}
把代码敲起来吧!QAQ
因篇幅问题不能全部显示,请点此查看更多更全内容