title: Java System.out.println Prints 20 times
body: <pre><code>import java.util.*;
  
  public class ArrayExample {
  
  public static void main(String[] args) {
      Scanner keyboard = new Scanner(System.in);
      boolean done = false;
      while (!done) {
  
          try {
              System.out.println("Please enter the size of the array:");
              String input = keyboard.next();
  
              int size = new Integer(input).intValue();
              int numbers[] = new int[size];
  
              for (int i = 0; i &lt; 20; i++) {
                  numbers[i] = i;
                  done = true;
                  System.out.println("Good.");
              }
          } catch (NumberFormatException ex) {
              System.out.println("NumberFormatException Error. Please enter a integer.");
          } catch (ArrayIndexOutOfBoundsException ex) {
              System.out.println("ArrayIndexOutOfBoundsException Error. Please enter 20 or higher.");
          } catch (NegativeArraySizeException ex) {
              System.out.println("NegativeArraySizeException Error. Please do not enter a negative.");
          }
      }
  }
  }
  </code></pre>
  
  <p>When I run this program it does not function properly. It should throw a exception unless I enter a INTEGER 20 or higher. However, it prints "Good." if I enter a number lower then 20. So if I enter 19 it will print "Good." 19 times. If I enter 3 it will print "Good." 3 times. I only want it to print "Good." if I enter 20 or higher. If not it should continue to loop through the exceptions.</p>