I have a problem. I want to display all address by URL, kind https://google.com, but I get an error:
Exception in thread "main" java.net.UnknownHostException: This host is unknown (https://google.com)
I know that by entering a regular domain (like google.com) into getAllByNAME , everything will work. Help me solve this problem please
My code:
public class Main {
public static void main(String[] args) throws UnknownHostException {
InetAddress[] inetAddress = InetAddress.getAllByName("https://google.com");
for (InetAddress key : inetAddress){
System.out.println(key.getHostAddress());
}
}
}