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