So I made an array:
public static Boolean[][] squaresWithPieces = new Boolean[][]{
{Boolean.TRUE,Boolean.TRUE,null,null,null,null,Boolean.FALSE,Boolean.FALSE},
{Boolean.TRUE,Boolean.TRUE,null,null,null,null,Boolean.FALSE,Boolean.FALSE},
{Boolean.TRUE,Boolean.TRUE,null,null,null,null,Boolean.FALSE,Boolean.FALSE},
{Boolean.TRUE,Boolean.TRUE,null,null,null,null,Boolean.FALSE,Boolean.FALSE},
{Boolean.TRUE,Boolean.TRUE,null,null,null,null,Boolean.FALSE,Boolean.FALSE},
{Boolean.TRUE,Boolean.TRUE,null,null,null,null,Boolean.FALSE,Boolean.FALSE},
{Boolean.TRUE,Boolean.TRUE,null,null,null,null,Boolean.FALSE,Boolean.FALSE},
{Boolean.TRUE,Boolean.TRUE,null,null,null,null,Boolean.FALSE,Boolean.FALSE}
};
and when I run my main() method, which executes the following:
for (int row = 0; row < squaresWithPieces.length; row++) // Cycles through rows.
{
for (int col = 0; col < squaresWithPieces[row].length; col++) // Cycles through columns.
{
System.out.printf("%5b ", squaresWithPieces[row][col]); // Change the %5d to however much space you want.
}
System.out.println(); // Makes a new row
}
I get the following output:
true true false false false false false false
true true false false false false false false
true true false false false false false false
true true false false false false false false
true true false false false false false false
true true false false false false false false
true true false false false false false false
true true false false false false false false
Why is that the case? I thought using Boolean class allows Booleans to be "null"?
This question also shows that.