How to compare Boolean?

后端 未结 7 1495
太阳男子
太阳男子 2021-01-01 09:39

Take this for example (excerpt from Java regex checker not working):

while(!checker) {
    matcher = pattern.matcher(number);
    if(matcher.find())
                 


        
7条回答
  •  爱一瞬间的悲伤
    2021-01-01 10:07

    As long as checker is not null, you may use !checker as posted. This is possible since Java 5, because this Boolean variable will be autoboxed to the primivite boolean value.

提交回复
热议问题