小编Mat*_*cro的帖子

是什么导致"二元运算符的错误操作数类型'=='"与第二类<nulltype>?

当我检查StoredCredential的实例是否为空时

if(storedCredential != null){
  //do something
}
Run Code Online (Sandbox Code Playgroud)

Netbeans 7.1显示以下警告:

bad operand types for binary operator '=='
  first type:  com.blah.dbcore.mypublic.beans.StoredCredential
  second type: <nulltype>
Run Code Online (Sandbox Code Playgroud)

它正确编译并且不抛出RuntimeExceptions,但Netbeans仍然显示警告.使用'!='检查实例是否为空,会给出相同的错误.

以下代码执行相同的操作,但不太清楚:

if (!(storedCredential instanceof StoredCredential)) {
  //do something
}
Run Code Online (Sandbox Code Playgroud)

Netbeans对这个表达没有任何问题.

因为编译没有问题,我假设我将包含类的.jar添加到库中的方式有​​问题.这是我对这个jar的唯一问题,但是这个.jar中没有其他类给我这个问题.

java netbeans

5
推荐指数
1
解决办法
6155
查看次数

标签 统计

java ×1

netbeans ×1