A simple Java Program to find the localhost IP Address of your System.
1 2 3 4 5 6 7 8 9 |
import java.net.InetAddress; public class ipAddress { public static void main(String args[]) throws Exception { InetAddress HostIP = InetAddress.getLocalHost(); System.out.println("Your IP4 Address : "+HostIP); } } |
To find you need to import InetAddress package.
Output of the program will be something like this,
Your IP4 Address : agur/192.168.1.104