InetAddress localhost = InetAddress.getLocalHost(); System.out.println("hostName:" + localhost.getHostName()); System.out.println("hostAddress:" + localhost.getHostAddress()); ### hostName:kanpiaoxue.org hostAddress: 10.27.16.42
InetAddress localhost = InetAddress.getLocalHost(); System.out.println("hostName:" + localhost.getHostName()); System.out.println("hostAddress:" + localhost.getHostAddress()); ### hostName:kanpiaoxue.org hostAddress: 10.27.16.42