O'Reilly logo

Java 2™ Programmer Exam Cram™ 2 (Exam CX-310-035) by Marcus Green, Bill Brogden

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Bitwise and Logical Operators

Table 3.4 summarizes the operators that can be used on individual bits in integer primitives and in logical expressions. Bitwise operators are used in expressions with integer values and apply an operation separately to each bit in an integer. The term logical expression refers to an expression in which all of the operands can be reduced to boolean primitives. Logical operators produce a boolean primitive result.

Table 3.4. Bitwise and Logical Operators
PrecedenceOperatorOperator TypeDescription
1~IntegralUnary bitwise complement
1!LogicalUnary logical complement
4<<IntegralLeft shift
4>>IntegralRight shift (keep sign)
4>>>IntegralRight shift (zero fill)
5instanceofObject, typeTests class membership
6==ObjectEquals (same ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required