title: java Exceptions Enter String only
body: <p>How to catch integer if the user must input String only, no integer and Symbols included to the input? Help me sir for my beginner's report.</p>
  
  <pre><code>import java.util.*;
  public class NameOfStudent {
  
  
      public static void main(String[] args) {
          Scanner input = new Scanner(System.in);
  
          String name = "";
  
          System.out.print("Please enter your name: ");
          name = input.nextLine(); // How to express error if the Strin contains
                                  //integer or Symbol?...
  
          name = name.toLowerCase();
  
          switch(name)
          {
          case "cj": System.out.print("Hi CJ!");
          break;
          case "maria": System.out.print("Hi Maria!");
          break;
          }
  
      }
  
  }
  </code></pre>