Java Arrays fill entire array

Description

Java Arrays fill entire array

import java.util.Arrays;

public class Main {
  public static void main(String[] args) {

    // fill 10-element array with 7s
    int[] filledIntArray = new int[10];
    Arrays.fill(filledIntArray, 7);
    System.out.println(Arrays.toString(filledIntArray));

  }/*from   w  w w. ja  va 2s  . c om*/
}



PreviousNext

Related