获取本机的IP

来源:互联网 发布:php 接口与抽象类区别 编辑:程序博客网 时间:2024/05/21 11:12

 

String ip = "";

InetAddress inet = null;

try {

inet = InetAddress.getLocalHost();

System.out.println(inet.getHostAddress());

} catch(Exception e) {

e.printStackTrace();

}

 

 

原创粉丝点击