分类: Java
2010-07-14 09:45:40
Hist:
1007014, draft
An array object contains a number of variables.These variables are called the components of the array. The components of the array are referenced using integer indices from 0 to n-1, inclusive.
All the components of an array have the same type, called the component type of the array. If the component type of an array is T, then the type of the array itself is written T[].
Array Types
An array type is written as the name of an element type followed by some number of empty pars of square brackets []. The number of bracket pairs indicateds the depth of array nesting.
Array Variables
An array is an object, and a variable of array type holds to a reference to the object.
Array Creation
It is a compile-time error if the element type is not a reifiable type
Array Access
Array Initializers
ArrayInitializer:
{ VariableInitializersopt ,opt }
VariableInitializers:
VariableInitializer
VariableInitializers , VariableInitializer
Array Members
1) public finale field, length
2) public method, clone. The return type of the clone method of an array type T[] is T[].
3) all the members inherited from class Object, the only method of Object that is not inherited is its clone method.
A clone of a multidimentsional array is shallow.
Class Objects for Arrays
An Array of Characters is Not a String
A String object is immutable. The method toCharArray in class String returns an array of characters. The StringBuffer implements useful methods on mutable arrays of characters.
Array Store Exception
REF
1. JLS 3nd