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