Hi, What type does bitwise operator &, ^, | take? I know thet take integer(that's what is said on Robert's book). Also It takes boolean( even "true" and "false" keywords). Thanks! Wei PS. I am planning to take the test this Friday.
When used with integer primitive values, | & and ^ are bitwise operations, when used with boolean they are of course boolean. In integer expressions, both sides are promoted to int or to long if one is long before the bitwise operation is carried out.
The bitwise operators can operate on all INTEGRAL types and not only int. as u said.In addition they can also be used with boolean literals(true and false).In that case true is treated as 1 and false as 0.The result is of type boolean.