当我编译并运行这段代码时:
public class Testing {
public static void main(String... args) {
Object obj = null;
if (obj instanceof Object) {
System.out.println("returned true");
} else {
System.out.println("returned false");
}
System.out.println(" " + obj instanceof Object);
}
}
我在命令行上得到这个:
C:\Users\xxxxxx\Desktop>java Testing
returned false
true
“null instanceof someType”不应该总是返回false吗?