Programming Tips - Java: Is there an easy way to do a DNS lookup?

Date: 2016mar22 Language: Java Q. Java: Is there an easy way to do a DNS lookup? A. Use the InetSocketAddress constructor:
try { InetSocketAddress addr = new InetSocketAddress("google.com", 80); System.out.println("address is " + addr.getAddress().toString()); } catch(IOException ex) { System.out.println("Can not lookup host"); }