`
public class YanghuiTest2 {
public static void main(String[] args) {
//动态初始化一个10行的二维数组
int[][] yh = new int[10][];
for (int i = 0; i < yh.length; i++) {
yh[i] = new int[i+1];
for (int j = 0; j <= i; j++) {
if (j == 0 || j == i) {
yh[i][j] = 1;
}else {
yh[i][j] = yh[i-1][j-1] + yh[i-1][j];
}
System.out.print(yh[i][j] + " ");
if (i == j) {
System.out.println();
}
}
}
}
}
`