"Exception in thread" and more
<pre><code>import java.util.Scanner;

public class Power1Eng {

public static void main(String[] args) {

    double x, prod = 1;
    int n;
    String s;

    Scanner input = new Scanner(System.in);

    System.out.print("This program prints x(x is a real number) raised to the power of n(n is an integer).\n");

    outer_loop:
    while (true) {
        System.out.print("Input x and n: ");
        x = input.nextDouble();
        n = input.nextInt();

        for (int i = 1; i &lt;= n; i++) {
            prod *= x;
        }

        System.out.printf("%.1f raised to the power of %d is %.4f. Do you want to continue?(Y/N) ", x, n, prod);
        s = input.nextLine();

        if (s.charAt(0) == 'Y')
            continue;
        else if (s.charAt(0) == 'N')
            break;
        else {
            inner_loop:
            while (true) {
                System.out.print("Wrong input. Do you want to continue?(Y/N) ");
                s = input.nextLine();

                if (s.charAt(0) == 'Y')
                    continue outer_loop;
                else if (s.charAt(0) == 'N')
                    break outer_loop;
                else
                    continue inner_loop;
            }   
        }   
    }       
}

}
</code></pre>

<p><img src="http://i.stack.imgur.com/oiadZ.jpg" alt="enter image description here"></p>

<p>There was only trivial logical error when I used just <code>next()</code> method, but when I changed
<code>next()</code> method to <code>nextLine()</code> method, this error shows.</p>

<p>How can I fix this problem?</p>
