Program to check an alphabet using method

class Alphabet
{
 public void checkVowel(char ch)
{
if(ch==‘a’||ch==‘e’||ch==‘i’||ch==‘o’||ch==‘u’||ch==‘A’||ch==‘E’||ch==‘I’||ch==‘O’||ch==‘U’)
{
System.out.println(“Given alphabet “+ch+” is an Vowel”);
}
else if((ch>=‘a’&&ch<=‘z’)||(ch>=‘A’&&ch<=‘Z’))
System.out.println(“Given alphabet “+ch+” is Consonant”);
else
System.out.println(“Not an alphabet”);
}
public static void main(String[ ] arg)
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

System.out.println(“Enter a character : “);

char chr=(char)br.read();

checkVowel(chr);

}

}

6 thoughts on “Program to check an alphabet using method

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.