JAVA获取当地的IP地址方法

JAVA获取本地的IP地址方法import java.net.InetAddresstry{InetAddress testInetAddress.getLocalHost()

JAVA获取本地的IP地址方法

import java.net.InetAddress;try{InetAddress test=InetAddress.getLocalHost();System.out.println(test.getHostAddress());}catch(UnknownHostException e){e.printStackTrace();}