1 for(int a = 5; a > 0 ; a--){ 2 for(int b = 1; b <= a; b++){ 3 System.out.print(" "); 4 } 5 for(int c = 5; c >= a; c--){ 6 System.out.print("* "); 7 } 8 System.out.println(" "); 9 } 10 for(int a = 4; a > 0 ; a--){ 11 for(int d = 1; d > 0; d--){ //这行for循环只是为了排版用的,实际意义不大 12 System.out.print(" "); 13 } 14 for(int b = 4; b >= a; b--){ 15 System.out.print(" "); 16 } 17 for(int c = 1; c <= a; c++){ 18 System.out.print("* "); 19 } 20 System.out.println(""); 21 }