What is the difference between Boolean.TRUE and true in Java?

后端 未结 7 1190
情歌与酒
情歌与酒 2020-12-15 03:02

PS: I understand the difference between \"true\" and true.

Edit: I also understand that Boolean.TRUE is a wrapper for the primitive true, my question then is - why d

相关标签:
7条回答
  • 2020-12-15 04:06

    You can also get an explanation on the link from Wikipedia below.

    All of the primitive wrapper classes in Java are immutable. J2SE 5.0 introduced autoboxing of primitive types into their wrapper object, and automatic unboxing of the wrapper objects into their primitive value—the implicit conversion between the wrapper objects and primitive values.

    More on http://en.wikipedia.org/wiki/Primitive_wrapper_class

    0 讨论(0)
提交回复
热议问题