Which of the following statements about declaration are true?
A. Declaration of primitive types such as Boolean, byte and so on does not allocate memory space for the variable.
B. Declaration of primitive types such as Boolean, byte and so on allocates memory space for the variable.
C. Declaration of nonprimitive types such as string, vector and so on does not allocate memory space for the object.
D. Declaration of nonprimitive types such as string, vector ans so on allocates memory space for the object.
1. Global variables:
When declaring a simple variable, the system will allocate space to it in the stack and give it a default value;
When declaring an object, the system also assigns a pointer to the object in the stack, but only points to null, rather than the memory space of the object.
2. Local variables:
Space will be allocated in the stack during the declaration (except that the object is still assigned a pointer to the object), and the system will not initialize the object by default, so it can only be used before initialization.
We can see from the above two points that BC is correct.