Example
public
static
void
main(
String
[] args ) {
Object o;
Object o2;
if
(o==
null
&& o.equals(o2)) {
o.toString();
}
}
Solution
In the above, a null pointer excepetion may occur when the method o.equals(o2) and o.toString() are executed. Reconsider the conditions in the if/else statement to ensure that a null-pointer excepetion will not be generated.