更新时间:2023-11-05 16:42:40
根据JLS§15.20.2:
如果将 RelationalExpression 转换为 ReferenceType 作为编译时错误被拒绝,那么
instanceof
关系ex压力同样产生编译时错误。在这种情况下,instanceof
表达式的结果永远不会为真。
If a cast of the RelationalExpression to the ReferenceType would be rejected as a compile-time error, then the
instanceof
relational expression likewise produces a compile-time error. In such a situation, the result of theinstanceof
expression could never be true.
RelationalExpression 是 instanceof
的第一个操作数, ReferenceType 是第二个。
RelationalExpression is the first operand of instanceof
and ReferenceType is the second.