Resolving ip-address of a hostname

java

Solution

Take a look at `InetAddress` and the `getHostAddress()` method.

InetAddress address = InetAddress.getByName("www.example.com"); 
System.out.println(address.getHostAddress()); 

Problem

I have the DNS server IP address and a hostname. Using Java, how can I find the IP address of the hostname as returned by that DNS server using the IP address and the hostname?

Original source

Related problems