美文网首页
获取IP地址和使用者

获取IP地址和使用者

作者: 南城的人 | 来源:发表于2017-04-18 08:51 被阅读0次

    本代码是用来获取所使用的电脑的 IP地址 和使用者的

        public class Main {
        public static void main(String[] args)
            throws Exception {
        InetAddress addr = InetAddress.getLocalHost();
        System.out.println("Local HostAddress: "+addr.getHostAddress());
                String hostname = addr.getHostName();
        System.out.println("Local host name: "+hostname);
         }
       }

    相关文章

      网友评论

          本文标题:获取IP地址和使用者

          本文链接:https://www.haomeiwen.com/subject/xpxfzttx.html