Question 1:java How does the memory be allocated in the process of declaring an array?
Build an array variable in the stack memory, and then build an array object in the heap memory. For detailed memory allocation details, it depends on whether the initialization is a dynamic initialization of an array or an array static initialization.
What are the initialization methods for the problem 2:java array?
Two types: dynamic initialization and static initialization. Dynamic initialization refers to specifying only the length of an array, without specifying the elements of each array. Static initialization refers to each element of the specified array in detail.
What is the difference between an array of basic types of 3:java and an array of application types, and the memory allocation mechanism at initialization time?
the basic type array of Java assumes that no element values are declared, then there will be default values, and the memory space allocated in the Java heap memory by the primitive type array is contiguous.
The Java application type array assumes that no element values are declared. Then the value of the array element is NULL, and the memory space allocated in the Java heap memory by the array of the applied type is not contiguous: Because each element object is generated in detail.
The array reference variable exists in the stack memory. The array object exists in heap memory.
Java Basic Concepts--arrays and memory control