<<< The Arrays class | Index | Relational Operators and Arrays >>> |
Code that uses the fill method
int[] quantities = new int[5]; Arrays.fill(quantities, 1); // all elements are set to 1
Code that uses the fill method to fill 3 elements in an array
int[] quantities = new int[5]; Arrays.fill(quantities, 1, 4, 100); // elements 1, 2, and // 3 are set to 100
<<< The Arrays class | Index | Relational Operators and Arrays >>> |