Avatar ·

What do three dots (...) mean in method parameters in Java?

Hello everyone! I just started learning Java and came across an unclear construct. In one code example, I saw a method declared like this: ```java public void printNumbers(int... numbers) { for (int num : numbers) { System.out.println(num); } } ``` What do these three dots `...` after the `int` type mean? I understand that it has something to do with passing multiple arguments, but I can't figure out the details. How does this work? Can you pass an array to such a method? Or only individual numbers separated by commas? And what happens if I pass both an array and individual values? I tried calling this method in different ways: ```java printNumbers(1, 2, 3); // Does this work? printNumbers(new int[]{4,5}); // And this? printNumbers(); // And without arguments?