An excellent String program to count words start and end with a vowel
String program to count words start and end…: solved Java program for ISC Class 11 Computer Science with complete BlueJ code, explanation and sample output.
Write a string program to accept a sentence from the user in uppercase. Count the number of words that start and end with a vowel. Bring all these words in the beginning of the sentence.
To learn more about string methods click the given link.
String handling in JAVA
import java.io.*;
public class VowelWord
{
String str="",str2="",s="",st="";
int len,count=0;
String arr[];
void input()throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("enter the string in upper case only");
str=br.readLine();
str=str.toUpperCase();
len=str.length();
}
void compute()
{
arr=str.split("\\s+");
int l=arr.length;
for(int i=0;i<l;i++)
{
if(vowel(arr[i])==true)
{
count++;
s+=(arr[i])+" ";
}
else
st+=(arr[i])+ " " ;
}
str2=s+st;
}
boolean vowel(String n)
{
char ch=n.charAt(0);
char ch2=n.charAt(n.length()-1);
if((ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U')&&(ch2=='A'||ch2=='E'||ch2=='I'||ch2=='O'||ch2=='U'))
return true;
else
return false;
}
void display()
{
System.out.println("The entered string was: "+str);
System.out.println("The number of words starting and ending with vowels in entered string are: "+count);
System.out.println("The changed string is: "+str2);
}
public static void main()throws IOException
{
VowelWord obj=new VowelWord();
obj.input();
obj.compute();
obj.display();
}
}enter the string in upper case only
MY NAME IS AESHA
The entered string was: MY NAME IS AESHA
The number of words starting and ending with vowels in entered string are: 1
The changed string is: AESHA MY NAME IS
To learn more basic java concepts watch the video.
https://youtu.be/QZKcULOC4lg
Related Posts
Continue learning with these related articles

Logic Gates for ISC Class 11: Truth Tables, Universal Gates, Half and Full Adder
ISC Class 11 Computer Science notes on logic gates: AND, OR, NOT, NAND, NOR, XOR and XNOR with truth tables, why NAND and NOR are universal gates, and half adder and full adder circuits with their Boolean expressions.
Decimal to Binary Conversion in Java: 3 Programs with Examples
How to convert a decimal number to binary on paper and in Java: three programs (String, place value and Integer.toBinaryString), binary to decimal, a dry run and common mistakes.

ISC Class 11 Computer Science Sample Paper 2026-27 with Solutions
A full 70-mark ISC Class 11 Computer Science sample paper for the 2026-27 annual exam: MCQs, number systems, propositional logic, logic gates, Java classes, arrays, strings, searching and sorting, and computing ethics, with complete worked solutions.