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[] args) throws 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]);
}
}
} |
|