InetAddress IsSiteLocalAddress() Example
Utility routine to check if the InetAddress is a site local address.
InetAddressclass IsSiteLocalAddress() method example. This example shows you how to use IsSiteLocalAddress() method.This method gives Utility routine to check if the InetAddress is a site local address.
Here is the code:-
/*
* @Program that gives Utility routine to check if the InetAddress is an site
local address.
* IsSiteLocalAddress.java
* Author:-RoseIndia Team
* Date:-19-Jun-2008
*/
import java.net.*;
public class IsSiteLocalAddress {
public static void main(String[] args) throws UnknownHostException{
InetAddress ia = InetAddress.getLocalHost();
System.out.println("InetAddress is an site local address: "+ia.isSiteLocalAddress());
}
} |
Output of the program:-
| InetAddress is an site local address: false |
|