Why is there no logical xor in JavaScript?
Why is there no logical xor in JavaScript? 19 Answers 19
Why is there no logical xor in JavaScript? 19 Answers 19
Observations: Java has a logical AND operator. Java has a logical OR operator. Java has a logical NOT operator. Problem: Java has no logical XOR operator, according to sun. I would like to define one. Method Definition: As a method it is simply defined as follows: public static boolean logicalXOR(boolean x, boolean y) { return … Read more
Java does have a logical XOR operator, it is ^ (as in a ^ b). Apart from that, you can’t define new operators in Java. Edit: Here’s an example: public static void main(String[] args) { boolean[] all = { false, true }; for (boolean a : all) { for (boolean b: all) { boolean c = a ^ b; System.out.println(a … Read more