java程序中数组大小如何自动递增我的要求是“创建一个二维数组sno,在第一个维度名称中,在第二个维度中年龄,所以如果我通过sds,25应该添加到数组[0] [ sds,25] 数组应该不断增加”我的代码是这样的:
void values() throws IOException{for ( int row = i; row < len; row++ ){
for ( int column = 1; column <= 1; column++ ){
arrayValues[row][0] = String.valueOf(row+1);
System.out.print("Enter "+(row+1)+" Name: ");
String name = br.readLine();
System.out.print("Enter "+(row+1)+" age: ");
int age = Integer.parseInt(br.readLine());
arrayValues[row][column]= name+","+age;
}
void incrementSize() throws IOException{String[][] newArray = new String[arrayValues.length][];
System.out.println(newArray.length);
String[][] t = Arrays.copyOf(arrayValues, newArray.length);
在此之后如何完成我的代码请帮助我