hi all ,
now i'm a little cofused over this one . what's the size of boolean in memory?
i know that it's JVM dependent but then why some people say that it takes 1 byte while others say that it doesn't take any memory at all ? i'll also quote something from just
java 2 here .
"boolean
This is the data type used for true/false conditions. To speed up memory access, implementations don't pack boolean values into the theoretical one-bit minimum space, but put each boolean into a byte.
.
.
.
Unlike some other languages, the Java boolean type is not based on integers. In particular, the Java programmer cannot increment, decrement, shift, or add boolean values. Inside a JVM, however, there are no instructions specifically for booleans, so integer operations (like assigning zero) are used. In the Sun JVM, the byte containing a boolean is promoted to 32 bits when pushed onto the stack during execution. So don't think booleans are a 1-bit type that economizes on storage."
what is the author trying to say ?