Java Program To Print Ip Address


package com.java2study;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class PrintIpAddress {

public static void main(String[] args) {

try {
System.out.println("your system current ip :"+InetAddress.getLocalHost());
} catch (UnknownHostException e) {

e.printStackTrace();
}

}

}

output


your system current ip :m-Lenovo-G560/127.0.1.1

No comments:

Post a Comment