Excellent articles KevinWorkman
! Now I don't have to explain this confusing but important concept by myself anymore!
However I've found out some glitches on 'em:
(-2 to the 7th) through (2 to the 7th) -1. Why that little -1 on the end? Because zero is in there, and zero counts as negative.
counts as positive
in computation. After all, its sign bit is 0
boolean - ... you're not supposed to ask. It holds a value of true or false, but it's really stored as a numeric value, probably in a byte-sized cup.
AFAIK, in Oracle, OpenJDK, Dalvik Java implementations, boolean
primitive type is a whole 8-bit byte. 7 bits go to waste!
... remember that the object is created out on the garbage-collectible heap. Always.
That's gonna surprise many Java veterans but, since Java 6, it features an über feature called "Escape Analysis":https://en.wikipedia.org/wiki/Escape_analysis
Java can decide to allocate a whole object in the stack
instead of regular heap if it's sure its reference won't escape/survive its local scope boundary!