How to present the nullable primitive type int in Java?

后端 未结 13 999
灰色年华
灰色年华 2020-12-03 13:29

I am designing an entity class which has a field named \"documentYear\", which might have unsigned integer values such as 1999, 2006, etc. Meanwhile, this field might also b

13条回答
  •  旧巷少年郎
    2020-12-03 14:06

    java.lang.Integer is reasonable for this case. And it already implemented Serializable, so you can save just only the year field down to the HDD and load it back.

提交回复
热议问题