There are 2 main types of main variables in Java:
Basic data Types : Byte, short, int, long and float, double, or master data type
And
Reference data Types : Arrays, classes, interfaces; Reference variables save the reference only, not the object itself ;
Reference passing is the use of a memory, a piece of memory can be used by many people;
because the " array is an object " in Java, regardless of whether it holds the primary data type or the object reference, but you can declare an array of values that can be loaded into the main data type.
An array object can have elements of the main data type, but the array itself is definitely not the primary data type???????
So, The use of arrays in Java must be "declared" and "allocated memory";
Each element in the array is a variable;
Routine 1: An array of master data
Int[] nums;//declaration of an array variable
Nums = new int[7];//allocates memory, creates an array of size 7//nums[0] is a variable of type int
NUMS[1] is a variable of type int
NUMS[2] is a variable of type int
Routine 2: An array of objects
Dog [] pets; Declaring a dog array
Pets = new Dog[7]; Allocates memory, creates a dog array of size 7, and assigns a variable pets to the dog[] type previously declared;
Pets[0] = new Dog (); Only reference variables with dog are in the array.
PETS[1] = new Dog (); Only reference variables with dog are in the array.
Definition and use of JAVA variables "the specificity of reference variables"