title: Make Arraylist() not allow input of numbers EDITED
body: <p>I am working on this project that allows the user to input names into the output window, but they are not suppose to be able to input numbers.  I can't figure out the correct line of code to make it to where they can't input numbers (If they do if will give them an error message).</p>
  
  <pre><code>import java.util.*;
  
  public class UserInput 
  {
  public static void main(String[] args) 
  {
      List&lt;String&gt; list = new ArrayList&lt;String&gt;();
    Scanner stdin = new Scanner(System.in);
  
    do 
      {   
       Collections.sort(list);
      System.out.println("Current list is " + list);
       System.out.println("Add more? (y/n)");
  
      if (stdin.next().startsWith("y")) 
          {
          System.out.println("Enter: ");
          list.add(stdin.next());
       } 
  
          else 
          {
          break;
       }
      } 
  
      while (true);
  
    System.out.println("List is " + list);
    String[] arr = list.toArray(new String[0]);
    System.out.println("Array is " + Arrays.toString(arr));
  }
  }
  public void add(String string) {
  
  try {  
     double d = Double.parseDouble(string);  
     } catch(NumberFormatException e) {  
         // throw a exception or something.
         return;
     }
  
     super.add(string);
     return;      
  }
  </code></pre>
  
  <p>Here is the code I have!</p>
  
  <p>Thanks so much for any help!</p>