java - Why is this a Boolean and how do i solve it? -
ok, aswitch object .status() method true or false
i want check each individual switch along column, , if on store column number of "on" columns in array count. tried variation of following no avail.
private aswitch[10][10] grid; public arraylist<integer> checkcol() { arraylist<integer> count = new arraylist<integer>(); int j =0; (int = 0; i<10; i++) if(grid[i][j].status()){ j++; if ( j == 9) { count.add(i); j=0; } } return count; } its halting on if (j == 9) line , think somehow thinks boolean value while think index value j.
any appreciated.
you correct in noting j not boolean value, if statements require boolean expression test true or false, (j == 9) 1 such boolean expression. it's no different if had string s , typed if(s.length() > 0).
Comments
Post a Comment