In my computer science course, we were taught that when creating an array, the JVM automatically allocates memory depending on the size of the array. For example, if you create an integer array of size 10, the JVM will allocate 10 * 32 bits of data to this array.
My question is, how exactly does this process work when you create object arrays with different sizes? For example, a String object. When you create an array of 10 lines, is there any memory reserved in the system for these lines, or since they are just pointers, no memory allocation is required?
source
share