六个for循环的Java小程序源码展播

文章作者 100test 发表时间 2007:10:10 12:23:25
来源 100Test.Com百考试题网


  1、
  /*
   * Created on 2004-8-22
   *
   * TODO To change the template for this generated file go to
   * Window - Preferences - Java - Code Style - Code Templates
   */
  
  /**
   * @author diyer6
   *
   * TODO To change the template for this generated type comment go to
   * Window - Preferences - Java - Code Style - Code Templates
   */
  /*
   此图是运行结果:
  **********
   *********
    ********
     *******
      ******
       *****
        ****
         ***
          **
           *
  */
  public class XingHaoOne {
   public static void main(String[] args) {
   for(int i=10.i>0.i--){
    for (int j=0. j < 10-i. j ) {
  
           System.out.print(" ").
          }
  
       for(int o=i.o>0.o--){
         System.out.print("*").
       }
    System.out.print("\n").
      }
    }
  
  2、
  /*
   * Created on 2004-8-22
   *
   * TODO To change the template for this generated file go to
   * Window - Preferences - Java - Code Style - Code Templates
   */
  
  /**
   * @author diyer6
   *
   * TODO To change the template for this generated type comment go to
   * Window - Preferences - Java - Code Style - Code Templates
   */
  /*
   此图是打印结果:
  
  *
  **
  ***
  ****
  *****
  ******
  *******
  ********
  *********
  **********
  
   */
  public class XingHaoTwo {
  
   public static void main(String[] args) {
   for(int i=10.i>0.i--){ 
       for(int n=i.n<11.n ){ 
  
         System.out.print("*").
        }
    System.out.print("\n").
      }
    }
  }


相关文章


六个for循环的Java小程序源码展播
基于Java2平台的引用类使用指南(图)
java学习——理解面向对象程序设计
Struts中bean:present使用方法
改进JAVA字符串分解的方法
澳大利亚华人论坛
考好网
日本华人论坛
华人移民留学论坛
英国华人论坛