-
Notifications
You must be signed in to change notification settings - Fork 1
/
Example 8.java
22 lines (18 loc) · 942 Bytes
/
Example 8.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import java.util.Scanner;
public class VowelCheck {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
// user to enter a character
System.out.print("Enter a character: ");
char character = scanner.next().charAt(0);
// Check if the character is a vowel
if (character == 'a' || character == 'e' || character == 'i' || character == 'o' || character == 'u' ||
character == 'A' || character == 'E' || character == 'I' || character == 'O' || character == 'U') {
System.out.println("The character is a vowel.");
}
if (character != 'a' && character != 'e' && character != 'i' && character != 'o' && character != 'u' &&
character != 'A' && character != 'E' && character != 'I' && character != 'O' && character != 'U') {
System.out.println("The character is not a vowel.");
}
}
}