【发布时间】:2011-11-22 18:41:42
【问题描述】:
我在查看java.net.InetAddressClass的源文件,发现很少有方法总是返回false。例如
/**
* Utility routine to check if the InetAddress is a site local address.
*
* @return a <code>boolean</code> indicating if the InetAddress is
* a site local address; or false if address is not a site local unicast address.
* @since 1.4
*/
public boolean isSiteLocalAddress() {
return false;
}
我错过了什么吗?为什么我们需要一个总是返回 false 的方法?这个类中所有以'is'开头的方法都是一样的。见http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/net/InetAddress.java
【问题讨论】:
标签: java