Java中'boolean'和'Boolean'的默认值

2022-01-19 00:00:00 default-value boolean java

Java中boolean(原始)和Boolean(原始包装)的默认值是什么?

What are the default values of boolean (primitive) and Boolean (primitive wrapper) in Java?

推荐答案

Boolean(对象)的默认值为null.
boolean 的 默认值(原始)是 false.

The default value for a Boolean (object) is null.
The default value for a boolean (primitive) is false.

相关文章