Write a java program to print the ip address

Write a java program to print the ip address. This is a Java program that displays the system’s IP address.An Internet Protocol address is represented by the InetAddress class. To get the IP address string in textual format, we use this class’s getHostAddress() method. Here is the source code for the Java programme that displays the system’s IP address.

import java.net.InetAddress;
public class Main
{
public static void main(String args[]) throws Exception
{
InetAddress IP = InetAddress.getLocalHost();
System.out.println("IP address= "+IP.getHostAddress());
}
}

IP address 000.000.000.000