Java program to print the IP (Internet Protocol) address of a computer system, we use InetAddress class of java.net package, the getLocalHost method returns InetAddress object, which represents the localhost.
Java IP address program
public static void main(String args) throws Exception
Download IP address program class file.
Output of program:
The output shows the computer name/ IP address of the computer. Java has a very vast Networking API, which can be used to develop network applications.