Community
Participate
Working Groups
The following code compiles: Object o=Math.random()<0.5 ? null : new Object(); System.out.println(""+o); The following code doesn't: Object o=Math.random()<0.5 ? null : new Object(); if (o==null) { } System.out.println(""+o); The null check complains that o might be null at the last line, which is just as possible as it was without the if statement. Even so, it doesn't even matter that o might be null there, as String concatenation works happily with null values.
*** This bug has been marked as a duplicate of 127919 ***