Write a Program to print the System ip address?
This program prints ip address of your computer system. InetAddress class of java.net package is used, getLocalHost method returns InetAddress object which represents local host.
Source code of the program:
import java.net.InetAddress;
class IPAddress
{
public static void main(String args[]) throws Exception
{
System.out.println(InetAddress.getLocalHost());
}
}
Output of the program: