Tuesday, June 19, 2007

How will you get an IP address of a machine from its hostname?

The following code snippet gives you the IP address on the basis of Hostname:

InetAddress inetAddress = InetAddress.getByName("www.interviewjava.blogspot.com");
System.out.println ("IP  Address: " + inetAddress.getHostAddress());

0 comments :

 

Disclaimer
Interview Questions On Java,Java EE Copyright © 2016. Reads: best tracker