In Java, the character data type, char
, is represented with 2 bytes. The array of n
characters, char[]
, is represented with 2n+24
bytes.
In general, there is an overhead of 24
bytes for storing an array of n
objects (at least if the objects are of primitive type).
Why do we need these additional 24 bytes? How are they used?
EDIT (July 2nd 2015). It was brought to my attention in a comment that an answer to this question is offered here on the programmers StackExchange.