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
Post a Comment