Method to record golf strokes
<p>The method is to record the number of strokes a player took when completing a hole. The method returns true when strokes are successfully recorded. There are 2 caveats: (1)the hole must be recorded in order and must start with 1. If a hole is received out of order, the score is not recorded and false is returned (2)The hole number must also be valid. You can't record a score for a hole that is less than 1 or greater than the number of holes on the course. When debugging my code give a java.lang.NullPointerException. What does that mean and how can i fix this.</p>

<p>Note: holesPlayed is an instance variable assigned the value of 0</p>

<p>Here is what i have:</p>

<pre><code>public boolean recordStrokes(int holeNumber, int strokes) {
    if ((holeNumber &gt;= 1) &amp;&amp; 
        (holeNumber &lt;= this.holesPlayed) &amp;&amp; 
        (holeNumber == holesPlayed + 1 
    {
        scores[holeNumber -1] = strokes;    
        holesPlayed = holesPlayed + 1;    
        return true;
    }    
    else { 
        return false;  
    }
}
</code></pre>
