0

Boolean

Boolean b; System.out.print(b); The result is error, why? By default b is false, so why doesn't it give false as output? A little bit confused

27th Aug 2019, 4:45 PM
Boubacar Toure
Boubacar Toure - avatar
3 Réponses
+ 1
Boubacar Toure i have no idea what you mean my dude
27th Aug 2019, 5:15 PM
Cat Sauce
Cat Sauce - avatar
0
a boolean is not false by default, it nothing, not true not false. so type Boolean b = false; System.out.println(b);
27th Aug 2019, 5:00 PM
Cat Sauce
Cat Sauce - avatar
0
Cat Sauce, Here is the answer to my question. The default value for a Boolean (object) is null. The default value for a boolean (primitive) is false.
27th Aug 2019, 5:12 PM
Boubacar Toure
Boubacar Toure - avatar