This program prints IP or Internet Protocol address of your computer system. InetAddress class of java.net package is used, getLocalHost method returns InetAddress object which represents local host.
Java programming source code
- import java.net.InetAddress;
- class IPAddress
- public static void main(String args) throws Exception
Download IP address program class file.
Output of program:
Output of code prints computer name/ IP address of computer. Java has a very vast Networking API which can be used to develop network applications.