[an error occurred while processing this directive]
Domain for sale!
Start Search Contents Index Links About
Rec.java
/*
 * Author: Havard Rast Blok
 * E-mail: 
 * Web   : www.rememberjava.com
 */

/*
 * Recursive counting
 */
public class Rec
{

  public Rec()
  {
    count0);
  }

  public void countint i, int stop )
  {
    //notice the the order of the recrusive call and the print line

    ifi < stop )
    {
      System.out.print(""+i+", ");
      counti+1, stop );
      System.out.print(""+i+", ");
    }
    else
    {
      System.out.println("");
    }
  }

  public static void mainString args[] )
  {
    new Rec();
  }

}


site: Håvard Rast Blok
mail:
updated: 16 July 2010