According to the output, java boolean false equals to 10011010101
and true equals to 4CF, 10011001111
. I don't understand why java uses these value for boolean. And what exactly boolean is stored?
Asked
Active
Viewed 53 times
1 Answers
8
Documentation for the %h
format specifier:
If the argument arg is
null
, then the result is"null"
. Otherwise, the result is obtained by invokingInteger.toHexString(arg.hashCode())
.
I think this speaks for itself. false
is boxed into Boolean.FALSE
, and that object happens to have a hash code.

Marko Topolnik
- 195,646
- 29
- 319
- 436
-
2And the `hashCode` for `true` is `1231`; `false` is `1237`. See http://stackoverflow.com/questions/3912303/boolean-hashcode – dejvuth Jul 30 '15 at 12:33