首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

java 获取当地ip 获取宽带ip

2013-10-24 
java 获取本地ip 获取宽带ippublic static void main(String[] args) {try {EnumerationNetworkInterface

java 获取本地ip 获取宽带ip
public static void main(String[] args) { try { Enumeration<NetworkInterface> netInterfaces = NetworkInterface.getNetworkInterfaces(); while (netInterfaces.hasMoreElements()) { NetworkInterface nif = netInterfaces.nextElement(); Enumeration<InetAddress> iparray = nif.getInetAddresses(); while (iparray.hasMoreElements()) { System.out.println("IP:"+ iparray.nextElement().getHostAddress()); } } } catch (Exception e) { System.out.println(e.getMessage()); } }

?

热点排行