java - How much space will be reserved for a non genric Arraylist while defining it -


by default when create arraylist without specifying size , create array of 10 elements in memory question is, if create list lst = new arraylist();

how many bytes reserved in memory lst?

the default capacity of arraylist has nothing generics.

if don't specify capacity, default capacity of 10. object array of 10 elements created, filled nulls.

an object array array of object references.

the memory cost of object reference depends on platform program running (typically 8 bytes on 64 bits os, 4 bytes on 32 bits os).


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -