title: How can I check if a value is in a certain place of a 2D array?
body: <p>I'm creating a 2D Array:
  <code>int[][] family = new int[10][];</code>
  and I then add the number two to it with <code>family[0][0] = 2</code></p>
  <p>How do I check if the value 2 is in the first element of the array or not?</p>
  <p>I've tried <code>if (family[0][0] == 2){return true;}</code> but when I run the program it just skips over it.</p>
  <p>Full code:</p>
  <pre><code>        int[][] family = new int[1000000][];
          Random rn = new Random();
          Family f = new Family();
          
          int answer = rn.nextInt(2) + 1;
  
          try {
              family[0][0] = answer;
          
  
          if (family[0][0] == 1) {
              System.out.println();
          }
              
          
          } catch (NullPointerException npe) {}```
  </code></pre>