I am having difficulty with a particular segment of a project and have created a test class in an attempt to debug it. The project requires a multi-dimensional array consisting of boolean values which I set to false and then specific coordinates of that grid to true. I then have a method with an if statement that if that boolean value is true then do such and such. It works backwards. Trying to look into the cause of this I created the following class:
Why can't I print those boolean values from the grid in this manner?public class booleanArrayTest { /** * @param args */ public int n = 9; public boolean[][] start = new boolean[n][n]; public void falseStart() { for (int x = 0; x < n; x++) { for (int y = 0; y < n; y++) { start[x][y] = false; } } } public void displayStart() { for (int x = 0; x < n; x++) { for (int y = 0; y < n; y++) { if (start[x][y] = false) { System.out.println(start[x][y]); } } } } public static void main(String[] args) { // TODO Auto-generated method stub booleanArrayTest ArrayTest = new booleanArrayTest(); ArrayTest.falseStart(); ArrayTest.displayStart(); } }
Thanks in advance