InetAddress GetByName() Example

Determines the IP address of a host, given the host's name.


InetAddressclass GetByName() method example. This example shows you how to use GetByName() method.This method Determines the IP address of a host, given the host's name.

Here is the code:-
/* 
 * @Program that Determines the IP address of a host, given the host's name.
 * GetByName.java 
 * Author:-RoseIndia Team
 * Date:-19-Jun-2008
 */

import java.net.*;

public class GetByName {
public static void main(String[] args)throws UnknownHostException {
    //Determines the IP address of a host, given the host's name.
     InetAddress ia = InetAddress.getByName("girish-desktop");
 System.out.println(ia);
    }

}

Output of the program:-
 girish-desktop/127.0.1.1

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US