// & vs &&

// if a is null, guaranteed a.isVisible will not be evaluated, thus avoiding a NullPointerException
if ( a != null && a.isVisible() ) doSomething();

// Sometimes generates a NullPointerException
if ( a != null & a.isVisible() ) doSomething();

// short circuit evaluation. If b < 1, it won't bother testing if b <= 10.
if ( 1 <= b && b <= 10 ) doSomething();

// does a bitwise AND on each of the 32 bits of an int.
int bitmask3 = bitmask1 & bitmask2;

// illegal. && does not work on ints.
int bitmask3 = bitmask1 && bitmask2;