Initializing an Array of Booleans code example
Example: how to initalize the array as to false
import java.util.Arrays;
public class BooleanArrayTest {
public static void main(String[] args) {
Boolean[] boolArray = new Boolean[5];
for(int i = 0; i < boolArray.length; i++) {
System.out.println(boolArray[i]);
}
Arrays.fill(boolArray, Boolean.FALSE);
for(int i = 0; i < boolArray.length; i++) {
System.out.println(boolArray[i]);
}
Arrays.fill(boolArray, Boolean.TRUE);
for (int i = 0; i < boolArray.length; i++) {
System.out.println(boolArray[i]);
}
}
}