展开全部
public static void println2() {
62616964757a686964616fe4b893e5b19e31333337623430for (int i = 1; i <= 5; i++) {
for (int j = 1; j <= 4; j++) {
System.out.print(i * j + "\t");
}
System.out.println();
}
}
这个结果就是
1234
2468
36912
481216
5101520
把每一行看做数组的一条内容
或者先定义一个5*4的二维数组,然后存值进去,再打印出来public static void println2() {
int[][] arr = new int[5][4];
for (int i = 0; i
for (int j = 0; j
arr[i][j] = i * j;
}
}
for (int i = 0; i
for (int j = 0; j
System.out.print(arr[i][j] + "\t");
}
System.out.println();
}
}