数组是Object类型的一个不明显扩展,所以可以指定一个数组给一个类型定义为Object的变量。
(1)字符串数组的构造函数
字符串数组声明三种方式:
String[] array=new String[5];
String[] array=new String[](“aa”,”ss”);
String[] array={“aa”,”bb”};
字符串数组和java.util.Date[],Object[]等,需要初始化
Int[],double[]都是原始类型,不需要初始化就可以使用。
(2)字符串数组的属性及常用方法
.length();arraycopy();
Array.arraycopy(Object[] from,int fromIndex,Object[] to,int fromIndex,int count);
从源数组(Object[] from)的第fromIndex个数开始复制,从(Object[] to)数组第fromIndex开始接受复制,复制count个元素。