双for循环

Posted jingcaibin

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了双for循环相关的知识,希望对你有一定的参考价值。

public class Dome1{
    public static void main (String []args){
        for(int i=1;i<=5;i++){
                for(int j=1;j<=5-i;j++){
            System.out.print(" ");        
        }
            for(int j=1;j<=2*i-1;j++){
                System.out.print("*");
            }
            System.out.println();
        }
        System.out.println("------------------");
    }
}

 

以上是关于双for循环的主要内容,如果未能解决你的问题,请参考以下文章