java获取ip地址

1 private static String getIpAddress(){
2         try {
3             return InetAddress.getLocalHost().getHostAddress();
4         } catch (UnknownHostException e) {
5             e.printStackTrace();
6         }
7         return null;
8 }

 

posted @ 2017-01-05 13:16  疯子~  阅读(178)  评论(0编辑  收藏  举报