数组的增添举例:
String[] phones = new String[] {"iPones4S", "iPones5", null};
// null 不用加双引号
Int index = -1;// 增加监视器
for (inti = 0; i<phones.length; i++) {// 1.增加iPones6
if (phones[i] == null) {
index = i;
break;
}
}
if (index != -1) {
phones[index] = "iPones6";
} else {
System.out.println("数组已满");
}
System.out.println(Arrays.toString(phones));