//int[][] result = new int[n][]; 生成了一个size为n的2D array 内容为null null null null....
public int[][] matrix(int n) {
if (n <= 0) return null;
int[][] result = new int[n][];
for (int i = 0; i < n; i++) {
result[i] = new int[i];
}
return result;
}
No comments:
Post a Comment