Créer une méthode qui accepte les ‘varargs’

Author:


Download

 
public class AffichageParametres {
  public static void AffichageParametres(String[] args) {
    afficherParamss(1, 2, 3);
    afficherParamss(10, 20, 30, 40, 50);
    afficherParamss(100, 200, 300, 400, 500);
  }
 
  public static void afficherParamss(int... nombres) {
    for (int nombre : nombres) {
      System.out.println(nombre + ", ");
    }
 
  }
}