public class WorkDemo04 {
/*
* 需求:
* *****
* *****
* *****
* *****
* *****
* 输出上述矩阵
*/
public static void main(String[] args) {
for(int a = 0;a < 5;a++){
for(int b = a;b < 4;b++){
System.out.print(" ");
}
for(int c = 0;c < 5;c++){
System.out.print("*");
}
System.out.println();
}
}
}
总结:1.外层循环一次,内层循环一遍