Can someone explain why this code?
Collection c = (5 == 5) ? new ArrayList() : new HashSet();
produces the following compiler error:
Incompatible conditional operand types ArrayList and HashSet
For reasons that I don't understand, the following fixes the problem
Collection c = (5 == 5) ? (Collection) new ArrayList() : new HashSet();
I'm using Java 1.4.
This was a bug in 1.4 and has been fixed according bugreport 5080917.
Evaluation This is a bug.
xxxxx@xxxxx 2004-07-30
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With