public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter a string: ");
String word = input.nextLine();
int i = 0, count = 0;
checkVowel(word, i, word.length()-1, count);
}
public static void checkVowel(String word, int start, int last, int count) {
if (start == last)
{
System.out.println("Total number of vowel is " + count);
}
else
{
if (word.charAt(start) == 'a' || word.charAt(start) == 'e' || word.charAt(start) == 'i' ||
word.charAt(start) == 'o' || word.charAt(start) == 'u') {
count++;
}
checkVowel(word, start++, last, count);
}
}
this is my code, but somehow i gt "Exception in thread "main" java.lang.StackOverflowError" , can anyone help find what's the problem??