import java.net.InetAddress;
import java.net.UnknownHostException;
public class IpAddressFinder {
public static void main(String[] args) {
// Get the local host name and the IP address.
try {
InetAddress addr = InetAddress.getLocalHost();
System.out.println("Local Host Name: " + addr.getHostName());
System.out.println("IP Address : " + addr.getHostAddress());
} catch (UnknownHostException e) {
e.printStackTrace();
}
}
}