// | vs ||

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

// 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();

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

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