The | and & check both the sides everytime.
if (str == null | str.length() == 0)
here we have high possibility to get NullPointerException
Logical || and && check the right hand side only if necessary.
but with logical operator
no chance to get NPE because it will not check RHS