Is there a simpler way to check multiple values against one value in an if-statement?

前端 未结 12 867
名媛妹妹
名媛妹妹 2020-11-27 07:55

Basically, what I want to do is check two integers against a given value, therefore, classically what you would do is something like this:

//just to get some         


        
12条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-27 08:03

    Even if you have used the bit-wise operation as Ted suggested, the expressions are not equal, since one requires at least one of the variables to be zero and the second requires both of them to be zero.

    Regarding your question, there is no such shortcut in Java.

提交回复
热议问题