title: NullPointerException in processing
body: <p>I have to make a program that will ask for the user to enter 10 names, then sort the names alphabetically, then print each name, how many characters, and how many vowels.
  I think I am close but keep getting this error in processing. Can anyone help with this? </p>
  
  <pre><code>`Exception in thread "Animation Thread" java.lang.NullPointerException
  at java.lang.String$CaseInsensitiveComparator.compare(String.java:1217)
  at java.lang.String$CaseInsensitiveComparator.compare(String.java:1211)
  at java.lang.String.compareToIgnoreCase(String.java:1258)
  at test.setup(test.java:35)
  at processing.core.PApplet.handleDraw(PApplet.java:2117)
  at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:193)
  at processing.core.PApplet.run(PApplet.java:2020)
  at java.lang.Thread.run(Thread.java:662)`
  </code></pre>
  
  <p>My code is:</p>
  
  <pre><code>import javax.swing.*;
  String names[] = new String[10];
  String temp;
  String nameInput;
  int length;
  int vowel = 0;
  char ch;
  length = 0;
  // store user input to array
  for (int i = 0; i &lt; names.length; i++) {
    nameInput = JOptionPane.showInputDialog ("Enter a name:");
    names[i] = nameInput;
    length = names[i].length();
  
  // sort into alphabetical order
    for (int j = 0; j &lt; names.length - 1; j++) {
      for (int k = j + 1; k &lt; names.length; k++) {
        if (names[j].compareToIgnoreCase(names[k]) &gt; 0) {
          temp = names[j];
          names[j] = names[k];
          names[k] = temp;
        }
      }
    }
    // count vowels
    char[] characters = nameInput.toCharArray();
    for (int m = 0; m &lt; characters.length; m++) {
      ch = nameInput.charAt(m);
  
      if ((ch == 'A') || (ch == 'a')
        ||  (ch == 'E') || (ch == 'e')
        ||  (ch == 'I') || (ch == 'i')
        ||  (ch == 'O') || (ch == 'o')
        ||  (ch == 'U') || (ch == 'u')) {
        vowel++;
      }
    }
  
    System.out.println("Name: " + names[i] + ", Length: " + length + ", Vowels: " + vowel);
    vowel = 0;
  }
  </code></pre>