How to formulate a NOR statement in Java

I'm just wondering how you can get the NOR operator in Java, like this

if (!(foo == "bar" || foo1=="bar1")){ ... } 

Edit: I was looking for a more efficient way to write that

+4
source share
1 answer

[...] I was looking for a more efficient way to write

There is no NOR operator in Java. You have to do it as you did

 !(A || B) 

or !A && !B , of course.

+15
source

All Articles