Saturday, 25 May 2013

Java Operators


What is the difference between the >> and >>> operators?
They perform bitwise signed and unsigned shifts, respectively.

What is the difference between the Boolean & operator and the && operator?
& is actually a bitwise operator that’s being applied on two boolean operands. The boolean operator will not evaluate the right operand if the left operand is already false.

What are order of precedence and associativity, and how are they used?
In complex expressions, the order in which the operations are performed is determined by the operator precedence. In expressions with operators with the same precedence order, the operations are performed in order from left to right or right to left, depending on the type of association.

Which Java operators are right associative?
=, +=, -=, *=, /=, %=, <<=, >>=, >>>= &=, ^=, |=, ++ (prefix), -- (prefix), + (unary), - (unary), !, ~, (type), new