Answers for "get vowel position in alphabet java"

0

alphabet n vowelin java

import java.util.Scanner;
public class VowelOrConsonant {
   public static void main(String args[]){
      System.out.println("Enter a character :");
      Scanner sc = new Scanner(System.in);
      char ch = sc.next().charAt(0);
      if(ch == 'a'|| ch == 'e'|| ch == 'i' ||ch == 'o' ||ch == 'u'||ch == ' '){
         System.out.println("Given character is an vowel");
      }else{
         System.out.println("Given character is a consonant");
      }
   }
}
Posted by: Guest on September-24-2021
-2

check vowel present in string java

public class FindingVowels {
   public static void main(String args[]) {

      String str = new String("Hi Welcome to Tutorialspoint");
      for(int i=0; i<str.length(); i++) {
         if(str.charAt(i) == 'a'|| str.charAt(i) == 'e'|| str.charAt(i) == 'i' || str.charAt(i) == 'o' || str.charAt(i) == 'u') {
            System.out.println("Given string contains "+str.charAt(i)+" at the index "+i);
         }
      }
   }
}
Posted by: Guest on November-06-2021

Code answers related to "get vowel position in alphabet java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language