The program to find the host address is given below
import java.net.*;
public class GetHostAddress{
public static void main(String[] args){
try{
InetAddress address = InetAddress.getLocalHost();
System.out.println(address.getHostAddress());
}catch(Exception e){
System.out.println(e);
}
}
}
0 Comments
If you have any question please ask?