1, one-dimensional arrays
1.1 to declare and initialize an array
declaration ways:
Static Initialization: Initialization and assignment simultaneously
Dynamic Initialization: Initialization and assignment separately
Description: Whether it is static or dynamic initialization initialization, the array is created if successful, the length of the array immutable.
1.2 calls the elements in the array
- An array index (the subscript: 0 starting from
- Value: String str = names [0]
- Assignment: names [0] = "aa";
1.3 Properties of the array - length (length of the array)
1.4 traversing the array
The default value of 1.5 array elements
The default value is the same as the array elements (depends on the specific element type) of defaults and member variables.
1.6 Analysis of memory arrays
2, two-dimensional array
2.1 declare and initialize an array of
arrays statement:
Static Initialization:
Dynamic Initialization:
2.2 Invoking the elements in the array
2.3 Properties of the array: length
2.4 traversing the array
The default value of 2.5 two-dimensional array of elements
The default value is 1. The two-dimensional array element is null
2.6 Analysis of two-dimensional array of memory
3, an array of common algorithm
Bubble algorithm:
4, using the tools of Arrays
5, an array of common exceptions
The first: null pointer exception - a NullPointerException
second: the subscript bounds - IndexOutOfBoundsException
Code:
6, a variable number of parameter
Format: method name (variable type ... Variable name)
Description:
- The number of parameters can be modified may be one or more 0
- If a method, in addition there are other parameters can be modified parameters, the parameters can be modified last.
- Only one method of a deformable parameter
- Method using variable parameters and parameter method using an array portion is the same