java获取net地址 本机

InetAddress netAddress;
		try {
			netAddress = InetAddress.getLocalHost();
			String name = netAddress.getHostName();
			System.out.println(name);
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} 

你可能感兴趣的:(java,InetAddress,本机地址)