[SOLVED] Detect LocalHost Name And IP Address.. This is my first tutorial at this forum, here i am showing you how to detect localhost name and local ip address
import java.net.*;
class Information
{
public static void main(String [] aa)
{
try{
System.out.println(InetAddress.getLocalHost().getH ostName());
System.out.println(InetAddress.getLocalHost().getH ostAddress());
}catch(Exception e){}
}
}
compile it with save and compile it
compile as follows:
javac Information.java
Run as follows:
java Information
note: If you face any problem please let me know... |