Sunday, 9 September 2012

program to get ip address using java


import java.net.InetAddress;

class IPAddress
{
public static void main(String args[]) throws Exception
{
System.out.println(InetAddress.getLocalHost());
}
}


Explanation:
                  This program prints ip address of your computer system. InetAddress class of java.net package is used, getLocalHost method returns InetAddress object which represents local host.

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...