标签:public
class TestFor1 { public static void main(String[] args) { for(int j =0;j<4;j++){ for(int i = 0; i<5 ; i++){ System.out.print("*"); } System.out.println(); } for(int j =0;j<4;j++){//外行循环控制行数 for(int i =0;i<j+1;i++){//每行输出j+1个 System.out.print("*"); } System.out.println(); } for(int j =0;j<4;j++){ for(int i = 0; i<(4-j) ; i++){ System.out.print("*"); } System.out.println(); } for(int i =0; i<5;i++){ for(int k = 0 ;k<4-i;k++){ System.out.print(" "); } for(int j = 0; j< i+1 ; j++){ System.out.print("* "); } System.out.println(); } for(int i =0;i<4;i++){ for(int k = 0 ;k<i+1;k++){ System.out.print(" "); } for(int j = 0; j< 4-i ; j++){ System.out.print("* "); } System.out.println(); } } }
标签:public
原文地址:http://9815936.blog.51cto.com/9805936/1600680