Program stay in a loop
<p>Here is the code in my World.java</p>

<pre><code>    while (option == 1)
    {
        a.generate();
        a.count();
        System.out.println("Max number is "+ a.maximum(max));
        System.out.println("Average number is "+ a.average(aver));
        System.out.println("Min number is "+ a.minimum(min));
        System.out.println("Do you want to run it again (y/n)?: ");
        a.getchoice();
    } 
    if (option == 2)
    {
        System.out.println("Program exits.");
        System.exit(0);
    }
</code></pre>

<p>And here is the code in my rg.java</p>

<pre><code>    public int getchoice() {
            Scanner reader = new Scanner(System.in);
            String selection = reader.nextLine();
            if(!selection.toLowerCase().equals("y") &amp;&amp; !selection.toLowerCase().equals("n"))
            {
                System.out.print("Invalid. Please enter “y” or “n”: ");
                return this.getchoice();
            }
            if (selection.toLowerCase().equals("y")){
                return 1;
            }
            else
            {
                return 2;
            }
</code></pre>

<p>I want to return variable to run the option y/n in the world class.</p>

<p>But the problem is if i press y after run the program, then something went wrong, either i press y or n the program is still execute as if the option is 1.</p>

<p>Can anybody check to find out which part was wronged in my code? Sorry about this newb code, since i just begin to learn java</p>
