Dear Java guru \'s!
Can you, please, explain me, why String concatenation does not work properly in Java when concatenating 2 results of ternary operators?
The problem is probably the order of operations. You can make it explicit by writing:
String x = (str != null ? "A" : "B") + (str == null ? "C" : "D");