Arrays and enhanced for statements
In JDK 1.5, the For statement is enhanced so that it is easier to iterate over the elements of an array
Basic format: It uses a type name in the For statement a variable name a colon an array name
int []num={1,2,3,4,5}
for (int n:num) {
SYSTEM.OUT.PRINTLN (n);
}
Such a traversal has to be made with elements that cannot change the element
Copying of arrays
The System.copyarray () method can be used to copy an array whose format is
System.arraycopy (Object src,int src_position,object dst,int dst_position,int length)
He copies the array from SRC to DST where the copy element is src_ the first src_position element of SRC, and the number of copy elements in the dst_position position of DST is length
Note: The method copies only the elements if the array element is a reference variable and only the copy reference does not copy the object entity
* Basic types (primitive type)
A variable of the base data type contains a single value whose length and format conform to the requirements of the data type to which the variable belongs, which can be a number, a character, or a Boolean value, such as an integer value of 32-bit binary complement format data, and a character type whose value is 16-bit Unicode character formatting data, and so on.
* Reference types (reference type)
The value of a reference variable is different from the base type variable, which is a reference (address) to the memory space. The memory pointed to holds a value or set of values represented by the variable.
References are referred to in other languages as pointers or memory addresses. Unlike other programming languages, the Java language does not support displaying the use of memory addresses, but must be accessed through variable names for a memory address.
My java--Array (3)