class Print {
public static void main(String[] args) {
for (int i = 1;i <= 4 ;i++ ) {
//打印行开始的空
for (int j = 1;j < i ;j++ ) {
System.out.print(" ");
}
//打印行后面的*
for (int k = 0;k <= 4 - i ;k++ ) {
System.out.print("*");
}
//换行
System.out.println();
}
}
}
|
|