Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to formulate the NOR operator in Java

Tags:

java

I was just wondering how 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

like image 564
user1510230 Avatar asked Aug 01 '12 18:08

user1510230


1 Answers

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

There is no NOR operator in Java. You have to do it as you've done

!(A || B)

or, !A && !B of course.

like image 66
aioobe Avatar answered Oct 09 '22 03:10

aioobe