Jump to Real's How-to Main page

Multiple expressions in for loops

You do it "à la C".
public class MultipleFor{
  public static void main (String [] args){
    for (int i=0, j=0; i < 10; i++, j--)
      System.out.println ("i = " + i + " j= " + j);
    }
}

If you find this article useful, consider making a small donation
to show your support for this Web site and its content.

Written and compiled by Réal Gagnon ©1998-2005
[ home ]