title: How can i test to see if the row is even in a 2d array?
body: <p>I'm trying to test each row in my array to see if they are even or odd. If the row is even i want to change the random value in the elements of the row to 0. If the row is odd i want to change the elements to 1. Ive been able to create the element and print it out but im stuck on how to test the rows. I know to test if a number is even you use (i % 2 == 0) but im not sure what coding i should use.</p>
  
  <pre><code>  public static void main(String[] args) {
  
      int[][] box;
      box = new int[2][2];
  
      int row;
      int column;
  
      for (row = 0; row &lt; box.length; row++) {
          for (column = 0; column &lt; box[row].length; column++) {
              box[row][column] = (int) (Math.random() * 100);
          }
      }
     //where im having issues
      // i get error 'bad operand types for binary operator'
  
       if (box[row] % 2 == 0) {
          for (row = 0; row&lt; box.length;row++){
             box[row][column] = [0][];
          }
       }
      else{
          for(row = 0; row &lt; box.length; row++){
              box[row][column] = [1][];
          }
      }      
  
      for (row = 0; row &lt; box.length; row++) {
          for (column = 0; column &lt; box[row].length; column++) {
              System.out.print(box[row][column] + " ");
          }
          System.out.println();
      }
  }
  }
  </code></pre>