**********
****  ****
***    ***
**      **
*        *
**      **
***    ***
****  ****
**********     只使用for循环语句          

解决方案 »

  1.   


    public class Test2{
      public static void print(){
          for(int i=0;i<5;i++){
           for(int j=i;j<5;j++){//第一部分*
      System.out.print("*");
       }
       for(int j=0;j<i*2;j++){//中间的空格
          System.out.print(" ");
       }
       for(int j=i;j<5;j++){//第二部分*
      System.out.print("*");
       }
       System.out.println(); 
      }
      for(int i=0;i<5;i++){ 
       for(int j=0;j<=i;j++){//第一部分*
      System.out.print("*");
       }
       for(int j=0;j<(5-i-1)*2;j++){//中间的空格
          System.out.print(" ");
       }
       for(int j=0;j<=i;j++){//第二部分*
      System.out.print("*");
       }
       System.out.println(); 
      } 
      }
      public static void main(String args[]){
          print();
      }
    }
      

  2.   

    sorry,多输出了一行,第二个for循环应该是for(int i=1;i<5;i++)从1开始循环
      

  3.   


    public class TestStar { public static void main(String[] args) {
    for(int i = 5; i > 0; i--){
    printStar(i,5-i);
    }
    for(int i = 1; i < 6; i++){
    printStar(i,5-i);
    }
    }

    static void printStar(int num,int kou){
    StringBuffer sb1 = new StringBuffer("");
    for(int i = 0; i < num; i++){
    sb1.append("*");
    }
    StringBuffer sb2 = new StringBuffer("");
    for(int i = 0; i < kou; i++){
    sb2.append("  ");
    }
    System.out.println(sb1.toString() + sb2.toString() + sb1.toString());
    }
    }楼主去试试..
      

  4.   

    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     *//**
     *
     * @author Administrator
     */public class NewClass
    {
        public static void main(String args[])
        {
            int line,star,space,count;
            for(line=0;line<9;line++)
            {
                if(line<=4)
                {
                    star=5-line;
                    space=2*(5-star);
                }
                else
                {
                    star=line-3;
                    space=2*(5-star);
                }
                for(count=0;count<star;count++)
                {
                    System.out.print("*");
                }
                for(count=0;count<space;count++)
                {
                    System.out.print(" ");
                }
                for(count=0;count<star;count++)
                {
                    System.out.print("*");
                }
                System.out.println();
            }    }}
      

  5.   

    看我的
    public class Test {
    public static void main(String[] args) {
    String[] s1 = { "**********", "****  ****", "***    ***", "**      **",
    "*        *" };
    for (int i = 0; i < 5; i++) {
    System.out.println(s1[i]);
    }
    for (int i = 3; i >= 0; i--) {
    System.out.println(s1[i]);
    }
    }
    }
      

  6.   

    噢 忘记是只能用for循环了 my god
      

  7.   


    宝宝大师说的多好  没有哪家公司 会说你们 编程只能用 for循环 不能用 if else 
    那样还编什么程 直接申请吉尼斯纪录说我的软件是第一个只用 for循环写的 看有人买不
      

  8.   


    public class TestPrint{ public static void main(String[] args) {
    for(int i=0;i<9;i++){
    for(int j=1;j<11;j++){
    if(j>1+Math.abs(i-4)&&j<10-Math.abs(4-i)){
    System.out.print(" ");
    }else{
    System.out.print("*");
    }
    }
    System.out.println();
    }
    }}
      

  9.   

        
        学习啦·~
           for循环用的很熟练啊·~