- '&' is bitwise. & evaluates both sides of the operation.
- '&&' is logical.&& evaluates the left side of the operation, if it's true, it continues and evaluates the right side.This is known as shortcircuiting and may be considered an optimisation. This is especially useful in guarding against nullness.
if( x != null && x.equals("JavaStuff.in") {
then do something with x...
}
Posted in: