Why does the Boolean object have a public constructor in Java?

前端 未结 5 1614
逝去的感伤
逝去的感伤 2021-01-03 20:58

Documentation for the constructor new Boolean(boolean value) in Java states:

Note: It is rarely appropriate to use this constructor. Unle

5条回答
  •  南方客
    南方客 (楼主)
    2021-01-03 21:25

    The reason it hasn't been deprecated is that Java maintains backwards compatibility to version 1.0

    I can't think of a good reason to use the constructor.

提交回复
热议问题