In Dan's mock Topic exam (Operators)
-------------------------------------------------
class B {
static boolean m(boolean b) {
System.out.print(b + " ");
return b;
}
public static void main(
String[] args) {
boolean a = false;
boolean b = false;
boolean c = true;
boolean d = false;
m(m(a | b == c & d) == m((a | b) == (c & d)));
}
}
--------------------------------------------------
The answer is "false, true, false".
I was confused with the last line code. If I changed "&" with "&&", "|" with "||", the result is the same. Does this mean that Bitwise operators are equal to logical operators when they were applied on boolean types?
In
Java Specification, "Bitwise Operators are to manipulate individual bits in an integral primitive data type". How to represent data of boolean type into bits?
TIA.
-Yan