Write a program in Java to accept 10 words in an array. display the words which start with vowel and ends with consonants.
Write a program in Java to accept 10 words in an array. display the words which start with vowel and ends with consonants.

import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter 5 words:");
String w[] = new String[5];
for (int i = 0;i < 5; i++)
w[i] = sc.next(); //taking input
System.out.println("The words starting with vowel and ending with consonants are: ");
for (int i = 0; i < 5; i++) {
String wd = w[i].toUpperCase(); //taking each word
char f = wd.charAt(0); //first character
char l = wd.charAt(wd.length()-1); //last character
String z="AEIOU"; //vowel string
if(z.indexOf(f)!=-1 && z.indexOf(l)==-1)
System.out.println(w[i]);
}
}
}