import java.net.*;
class MyIp
{
public static void main(String args[])
{
try
{
InetAddress i =InetAddress.getLocalHost();
String name=i.getHostAddress();
String hname=i.getHostName();
System.out.println("Ip address= "+name);
System.out.println("Ip name= "+i);
System.out.println("Host name= "+hname);
}
catch(Exception e)
{}
}
No comments:
Post a Comment