This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Question from the test... Given the following code snippet: String s = null; Which of the following will throw NullPointerException... 1) if (( s!= null ) & ( s.length() > 0 )) 2) if (( s!= null ) && ( s.length() > 0 )) 3) if (( s!= null ) | ( s.length() > 0 )) 4) if (( s!= null ) | | ( s.length() > 0 )) 5) none of the above The answer says that 1,2,3 & 4 will cause NullPointerExceptions. Shouldn't number 2 short-circuit before it hits the s.length() statement, and thusly leave 1, 3 & 4 as the correct answers.