Skip to main content

Posts

Showing posts with the label 7. Write a Java program to input any alphabet and check whether it is vowel or consonant.

ads1

7. Write a Java program to input any alphabet and check whether it is vowel or consonant.

    7. Write a Java program to input any alphabet and check whether it is vowel or consonant.   Static   Solution :- class vowel {     public static void main(String args[])     {     String  ch ="F";         if(ch =="a"||ch =="e"||ch =="i"||ch =="o"||ch =="u"||ch =="A"||ch =="E"||ch =="I"||ch =="O"||ch =="U")         {             System.out.println("It is Vowel :- "+ch);         }            else     {         System.out.println("It is not a  Vowel :- "+ch);     }     } }  Output :-  Dynamic Solution :- import java.util.*; class vowel {     public static void main(String args[])     {         char ch;          Scanner out = new Scanner(System.in);         System.out.println("Enter the Character :- ");         ch = out.next().charAt(0);     if(ch =='a'||ch =='e'||ch =='i'||ch =='o'||ch =='u'||ch ==

ads2