Monday, July 18, 2011

Java Questions - 15

What can go wrong if you replace && with & in the following code:
String a=null; if (a! =null && a.length ()>10) {...}

A single ampersand here would lead to a NullPointerException.

No comments: