In this article, we are going to check given character is vowel or not using Java.
Java code to check character is vowel or not:-
package learn;
import java.util.Scanner;
public class VowelOrNot {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the Charcter");
char c = sc.next().charAt(0);
if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u' || c=='A' || c=='E' || c=='I' || c=='O' || c=='U' ) {
System.out.println("Charcter is vowel");
}
else {
System.out.println("Character is not vowel");
}
}
}
Output When character is not a vowel:-
![wap to check character is vowel or not](https://gangforcode.com/wp-content/uploads/2022/12/image-24.png)
Output when character is a vowel:-
![Character is vowel](https://gangforcode.com/wp-content/uploads/2022/12/image-25.png)