Inet4Address IsSiteLocalAddress() Example
returns a boolean if the InetAddress is a site local address
Inet4Addressclass IsSiteLocalAddress() method example. This example shows you how to use IsSiteLocalAddress() method.This method returns a boolean if the InetAddress is a site local address
Here is the code:-
/*
* @Program to check if the InetAddress is a site local address.
* IsSiteLocalAddress.java
* Author:-RoseIndia Team
* Date:-28-Jun-2008
*/
import java.net.*;
import java.util.*;
public class IsSiteLocalAddress {
public static void main(String[] args) throws Exception {
InetAddress i = Inet4Address.getByName("localhost");
boolean b = i.isSiteLocalAddress();
System.out.println("InetAddress is a site local address: " + b);
}
} |
Output of the program:-
| InetAddress is a site local address: false |
|