title: Try...catch block doesn't define variable
body: <p>I have a program, which takes a parameter from the <code>args[]</code> array, defined in the main method, but has a backup in case that isn't defined, in the form of a try...catch block, which, if an <code>ArrayIndexOutOfBounds</code> exception is thrown, instead uses a method called <code>getInt</code> to prompt the user to enter a variable. But, for some reason, when I try to use that variable, my compiler says that it cannot find it. I have the following code:</p>
  
  <pre><code>try {
      int limit = Integer.parseInt(args[0]);
  }
  catch(ArrayIndexOutOfBoundsException e) {
      int limit = getInt("Limit? ");
  }
  int[] p = getPrimes(limit);
  </code></pre>
  
  <p><code>getPrimes</code> is another method I have, which returns an array of prime numbers starting from 2 and up to a specified number (using the Sieve of Atkin). Anyway, when I write <code>int[] p = getPrimes(limit);</code> and try compiling, it says that the "limit" variable is not defined. Help please!</p>