-3

How can i make a method with a string and unknown number of intarguments?

Thanks.

Ofir Ohayon
  • 367
  • 2
  • 18

1 Answers1

2
public void printXXX(char c, int... ints) {
    for (int i : ints) {
        for (j = 0; j < i; j++) {
            System.out.print(c);
        }
        System.out.println();
    }
}
Jazzwave06
  • 1,883
  • 1
  • 11
  • 19