Array,AList
two elements in Array:
- fix length of an Array. N
- A sequence of N memory boxes (N = length) where all boxes are of the same type, and are numbered 0 through N - 1.
Three valid notation for array creation:
x = new int[3];
y = new int[]{1,2,3,4,5};
int[] z = {9,10,11,12};
The first two notation use new, the last one omits it.
The first method’s default value is 0.
得到的结果就是empty array
int[] b = {9, 10, 11};
int[] x = {1,2,3,4,5,6};
System.arraycopy(b, 0, x, 3, 2);
arraycopy:
- the array source of arraycopy.
- the start copy position in array source.
- the destination of arraycopy
- the number of elements that arraycopy have to copy.
outcome:
class与arrays
class可以有不同的数据类型,array数据类型必须一样
都有几个记忆箱去存储数据
import只能import文件夹