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