title: How to end a while loop which is accepting char continuously
body: <p>I am checking if an input is a vowel, a consonant or otherwise. I want to breakout of my while loop when any other data type (int, double, long etc.) is entered. Thanks in advance for any assistance.</p>
  
  <pre><code>import java.util.Scanner;
  /**
   *
   * @author Babatunde
   */
  public class vowelConsonantOne {
  
      /**
       * @param args the command line arguments
       */
  
      public static void main(String[] args) {
          char ch;
          Scanner sc = new Scanner(System.in);
          while (true) {
              System.out.println("Enter an Alphabet");
              ch = sc.next().charAt(0);
  
              if (ch == 'A' || ch == 'a' || ch == 'E' || ch == 'e' || ch == 'I' || ch == 'i' || ch == 'O' || ch == 'o' || ch == 'U' || ch == 'u') {
                  System.out.println("This is a vowel");
              } else {
                  System.out.println("This is a consonant");
              }
          }
      }
  
  }
  </code></pre>