isLinkLocalAddress(): This method is available in the java.net.Inet4Address class of Java.
Syntax:
boolean java.net.Inet4Address.isLinkLocalAddress()
Utility routine to check if the InetAddress is a link-local address.
Parameters: NA
Returns: a boolean indicating if the InetAddress is a link-local address; or false if the address is not a link-local unicast address.
Exceptions: NA
Approach
Java
package com.Inet4Address;import java.net.Inet4Address;import java.net.UnknownHostException;public class Inet4AddressisLinkLocalAddress {public static void main(String[] args)throws UnknownHostException {String host = "beingcodeexpert.blogspot.com";Inet4Address inet4Address =(Inet4Address) Inet4Address.getByName(host);System.out.println(inet4Address.isLinkLocalAddress());}}
Output:
false
No comments:
Post a Comment