Table of Content

Fill an Integer Array in Java

Declaration :

Explanation :

Purpose The java.util.Arrays.fill(int[] a int val) method assigns the specified int value to each element of the specified array of ints.
Parameters a ===> This is the array to be filled.
val ===> This is the value to be stored in all elements of the array.
Return Value This method does not return any value.
Exception NA

Java Program : Example

Below example will explain java.util.Arrays.fill() method.

Output of Program :