title: Throwing NullPointerException for CodeWar question (Counting sheep)
body: <p>I am doing a question in CodeWar and I had encountered a few problems. The question basically accepts a Boolean array to count the number of sheep (true = add 1 to sumOfSheep, false does not add 1 to sum). This is the input and my code.</p>
  <pre><code>Boolean[] array1 = {true,  true,  true,  false,
                    true,  true,  true,  true ,
                    true,  false, true,  false,
                    true,  false, false, true ,
                    true,  true,  true,  true ,
                    false, false, true,  null };
  
  
  public class Counter {
    public int countSheeps(Boolean[] arrayOfSheeps) {
      int sumOfSheep = 0;
      for(Boolean sheep:arrayOfSheeps){
        if(sheep){
          sumOfSheep++;
        }
        else if(sheep == null){
          continue;
        }
      }
      return sumOfSheep;
    }
  }
  </code></pre>
  <p>After running this code, it will return a NullPointerException. I have tried to print out every element in the array and I noticed that it will crash when it encounters a null value.</p>
  <pre><code>if(sheep){
          sum++;
          System.out.print(sheep);
          System.out.println(&quot; Good&quot;);
        }
        else if(sheep == null){
          System.out.println(&quot;Bad&quot;);
          continue;
        }
  </code></pre>
  <p>The program won't crash if I change the if statement's condition to <code>if(sheep != null &amp;&amp; sheep)</code>. Can I know why is this happening??</p>