Java Program to find all the addresses of the host is given below.
import java.net.*;
public class GetAllHostName{
public static void main(String[] args){
try{
InetAddress[] addresses = InetAddress.getAllByName("www.google.com");
for( InetAddress address:addresses ){
System.out.println(address);
}
}catch(UnknownHostException e){
System.out.println(e);
}
}
}
0 Comments
If you have any question please ask?