How to get the IP address from the Domain Name in Java?

ip-address, java

Solution

InetAddress giriAddress = java.net.InetAddress.getByName("www.girionjava.com");

Then, if you want the IP as a String

String address = giriAddress.getHostAddress();

Problem

I am writing an application where I need the IP address. I have a domain name and I would like to know how to get the IP address from it. For example, "www.girionjava.com". How could I get the IP address of this website by programming in Java? Thanks.

Original source