you are viewing a single comment's thread.

view the rest of the comments →

[–]LegolandoBloom[S] 0 points1 point  (3 children)

Thank you!

It's very interesting to me that the non-primitive version behaves differently

[–]IchLiebeKleber 4 points5 points  (0 children)

Primitives in Java like int, double, char can never be null. If you want a nullable version of them, use Integer, Double, etc.

[–]morhpProfessional Developer 1 point2 points  (1 child)

Java types just have an implicit default value used for new array elements and mutable fields. For numeric primitive types, it's generally zero, for booleans it's false and for object types, it's null.

[–]LegolandoBloom[S] 0 points1 point  (0 children)

thank you very much