Java Program to check whether input character is vowel or consonant

In this tutorial you will learn about the Java Program to check whether input character is vowel or consonant and its application with practical example.

In this tutorial, we will learn to create a Java Program to check Input Numbers is vowel or consonant in Java using Java programming.

Prerequisites

Before starting with this tutorial we assume that you are best aware of the following Java programming topics:

  • Java Operators.
  • Basic Input and Output function in Java.
  • Class and Object in Java.
  • Basic Java programming.
  • If-else statements in Java.
  • For loop in Java.

Vowel 

A vowel is a letter that speak with an open sound without closing any part of the mouth is called as vowel.
Example : a,e,i,o,u.

Consonant

A consonant is a speech sound that is not a vowel.
Example:- As we know a,e,i,o,,u are called vowels. And renaming are called consonants.

Java Program to check whether input character is vowel or consonant

In this program we will learn to create a Program that checks weather input character is Vowels and Consonants .We would first declared and initialized the required variables. Next, we would prompt user to input a character. Later in program we will find inputted character is Vowels or Consonants .

Output

Vowel

Consonant

In the above program, we have first declared and initialized a set variables required in the program.

  • ch= it will hold given character.

And in the next statement we will ask user to input Character as shown in picture below.

After taking value from user with the help of “if-else” statement we will check the inputted character is a vowel or consonant, using following logic.

Logic For Vowel.

For Consonant.

Note : Inputted value by user must be a Character.

In this tutorial we have learn about the Java Program to check whether input character is vowel or consonant and its application with practical example. I hope you will like this tutorial.