InetAddress IsLoopbackAddress() Example

Utility routine to check if the InetAddress is a loopback address.


InetAddressclass IsLoopbackAddress() method example. This example shows you how to use IsLoopbackAddress() method.This method gives Utility routine to check if the InetAddress is a loopback address.

Here is the code:-
/* 
 * @Program that gives Utility routine to check if the InetAddress is a
    loopback address.
 * IsLoopbackAddress.java 
 * Author:-RoseIndia Team
 * Date:-19-Jun-2008
 */

import java.net.*;
public class IsLoopbackAddress {
public static void main(String[] args)throws UnknownHostException {
InetAddress ia = InetAddress.getLocalHost();
System.out.println("Inetaddress is a link loopback address: "+ia.isLoopbackAddress());
    }

}

Output of the program:-
 Inetaddress is a link loopback address: true

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US