标签:int,System,空心,空格,print,金三角,out From: https://www.cnblogs.com/hhxz/p/17212997.html
for (int i = 0; i < 10; i++) {
//对应“*”前的空格
for(int k=1;k<=10-i;k++){
System.out.print(" ");
}
//每行对应的“*”号数
for (int j = 1; j <= 2*i-1; j++) {
//用判断选择输出“*”还是“ ”空格
if(j==1||j==(2*i-1)||i==9){
System.out.print("*");
}else {
System.out.print(" ");
}
}
//换行
System.out.println();
}