Java Code to Get IP Address - Computer Programming

Latest

C C++ Java Python Perl Programs Examples with Output -useful for Schools & College Students

Monday, September 25, 2017

Java Code to Get IP Address

Write a Java Code to Get IP Address

Program:
import java.net.InetAddress;

public class JavaProgram
{
public static void main(String args[]) throws Exception
{

// prints the IP address of your Computer
System.out.println(InetAddress.getLocalHost());

}
}

Output:

DEV-PC/192.168.137.128

No comments:

Post a Comment