InetAddress GetAddress() Example

Returns the raw IP address of this InetAddress object.


InetAddressclass GetAddress() method example. This example shows you how to use GetAddress() method.This method Returns the raw IP address of this InetAddress object.

Here is the code:-
/* 
 * @Program that Returns the raw IP address of this InetAddress  object.
 * GetAddress.java 
 * Author:-RoseIndia Team
 * Date:-19-Jun-2008
 */

import java.net.*;

public class GetAddress {

    public static void main(String[] argsthrows UnknownHostException {
        InetAddress ia = InetAddress.getLocalHost();
        //Returns the raw IP address of this InetAddress  object.
        byte b[] = ia.getAddress();
        for (int i = 0; i < b.length; i++) {
            System.out.println(b[i]);
        }
    }
}

Output of the program:-
 127
0
1
1

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

HOME | COPYRIGHT | CONTACT US