We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8a9659c commit 317b3e3Copy full SHA for 317b3e3
src/JavaPrograms/VowelAndConsonent.java
@@ -0,0 +1,33 @@
1
+package JavaPrograms;
2
+
3
+public class VowelAndConsonent {
4
5
+ public static void main(String[] args) {
6
7
+ // vowel are : a e i o u
8
+ char ch = 'm';
9
+ if(ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u') {
10
+ System.out.println(ch + " is vowel");
11
+ }
12
+ else {
13
+ System.out.println(ch + " is consonent");
14
15
16
+ // 2nd way, we can use switch case
17
+ char chrc = 'u';
18
+ switch (chrc) {
19
+ case 'a':
20
+ case 'e':
21
+ case 'i':
22
+ case 'o':
23
+ case 'u':
24
25
+ System.out.println(chrc + " is vowel");
26
+ break;
27
28
+ default:
29
+ System.out.println(chrc + " is consonent");
30
31
32
33
+}
0 commit comments