Java示例getHostAddress()和getHostName() Java示例主机特定IP地址 Java示例文件修改时间 Java示例getHostAddress()和getHostName() import java.net.InetAddress; import java.net.UnknownHostException; public class Demo { public static void main(String[] args) { InetAddress ipadd; String hostname; try { ipadd = InetAddress.getLocalHost(); hostname = ipadd.getHostName(); System.out.println("Your IP address : " + ipadd); System.out.println("Your Hostname : " + hostname); } catch (UnknownHostException e) { } } } Java示例主机特定IP地址 Java示例文件修改时间