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