title: Java compiler error variable is already defined
body: <p>I am new to programming and am having difficulty figuring this error out:</p>
  
  <pre><code>C:....&gt;javac Power.java
  Power.java:12: error: variable i is already defined in method main(String[])
      `for(int **i** = 0; i &lt; upper_limit + 1; i++)`
  </code></pre>
  
  <p>Here is the entire program. I'm sure the answer is super simple but for the life of me I can't figure it out.</p>
  
  <pre><code>import java.util.Scanner;
  
  public class Power {
      public static void main( String args[] ) {
          Scanner input_scanner = new Scanner(System.in);
          System.out.print("Powers of 2 up to? ");
          int upper_limit = input_scanner.nextInt();
          int i = 0;
          for (int i = 0; i &lt; upper_limit + 1; i++) {
              System.out.println(i + " - " + Math.pow(2, i));
          }
      }
  }
  </code></pre>