获取本地IP Posted on 2019-12-19 | In Java代码片段 获取本地IP12345678910InetAddress ia = null;try{ ia = ia.getLocalHost(); String localName = ia.getHostName(); String localIP = ia.getHostAddress(); Systemt.out.println("本机名称是:" + localName); Systemt.out.println("本机的IP是:" + localIP);} catch(Exception e){ e.printStackTrace();} Donate WeChat Pay