Créer plusieures Expressions dans une boucle ‘for’

Author:


{filelink=4399}


public class Main {
  public static void main(String[] args) {
    for (int i = 0, j = 0; i < 5; i++, j--)
      System.out.println("i = " + i + " j= " + j);
  }
}
/*
i = 0 j= 0
i = 1 j= -1
i = 2 j= -2
i = 3 j= -3
i = 4 j= -4
*/

A Voir sur le même Sujet:

  • Boucle For Java

Leave a Reply

Your email address will not be published. Required fields are marked *