package javatext;
public class array4 {
public static void main(String[] args) {
int [] unms = new int[5]; //数组创建之后,长度不变
unms[0] = 11;
unms[1] = 21;
unms[2] = 31;
unms[3] = 41;
unms[4] = 51;
//创建比原数组长的新数组
int newNums [] = new int[unms.length * 2];
//复制原数组中的所有数组数据到新数组中
for (int i = 0; i < unms.length; i++) {
newNums[i] = unms[i];
}
//打印原数组
for (int i = 0; i < unms.length; i++) {
System.out.print(unms[i] +"\t" );
}
System.out.println();
//遍历新数组
for (int i = 0; i < newNums.length; i++) {
System.out.print(newNums[i] + "\t");
}
}
}