5.
class Demo {
public static void main(String[] args) {
int[][] arr = new int[4][];
int num = 1;
for (int i=0; i<arr.length; i++) {
arr[i] = new int[i+1];
for (int j=0; j<arr[i].length; j++) {
arr[i][j] = num++;
System.out.print(arr[i][j]);
}
System.out.println();
}
}
}
答案:1
23
456
78910
谁能解释下这段代码什么意思?
|
|