I am getting NullPointerException from the below line sometimes.
System.out.println("Date::"+ row != null ? row.getLegMaturityDate() : "null");
After adding brackets, it is fine.
System.out.println("Date::"+ (row != null ? row.getLegMaturityDate() : "null"));
Please clarify me the behavior. Thanks in advance.
"Date::" + rowis never null, althoughrowsometimes is.That is,
"Date::"+ row != nullis equivalent to("Date::"+ row) != nullwhich is always true.