Question Concerning a CodingBat Beginner Problem
<p>So I've been practicing my Java programming skills on the CodingBat website, when I came across <a href="http://codingbat.com/prob/p146974" rel="nofollow" title="this">this</a> problem. In it, you have to make a simple method that takes in an array of integers of dynamic length, check to see if the elements in the array are in increasing order (1, 2, 3, 15678, etc), and return "true" if true, or "false" if there is an integer out of order.</p>

<p>Firstly, I initialize a boolean variable named "result". Then, I iterate through the array of integers passed by the method. If the current index value is less than the next index value, I set "result" to "true", and repeat the loop. Else, I'll set "result" to "false", break out of the loop and set "result" to "false". After the FOR loop, I return "result".</p>

<p>However, I've been receiving an error message that "result" has not been initialized properly. I can kinda understand the confusing with the JVM, however I thought that setting the value for "result" inside of the IF/ELSE statements would solve that.</p>

<p>Here is a copy of the code that I have done so far:</p>

<p>EDIT: For posterity, I have edited out the wrong code for the correct code that works. Feel free to check it out and learn from it as I have. It appears that I forgot (among other things) to check the actual ELEMENT inside of the FOR loop, not necessarily the reference itself. Thanks a ton, everyone!</p>

<pre><code>public boolean scoresIncreasing(int[] scores) {
    for (int i = 0; i &lt; scores.length - 1; i++) {
        if (scores[i] &gt; scores[i + 1]) {
            return false;
        }
    }
    return true;
}
</code></pre>
