int[] arr = new int[5];
arr[0] = 23;
arr[1] = 123;
arr[2] = 255;
printArray(arr);
}
static void printArray(int...arr) {
for (int T : arr)
System.out.println(T);
}
Prints this:
23
123
255
0
0
So how to avoid not printing unfilled elements, please?
0
. – Paul Boddington Oct 21 '17 at 13:38int[] arr = new int[3];
? – Gilles Gouaillardet Oct 21 '17 at 14:22