index « substring « Java Data Type Q&A

1. String index out of bounds? (Java, substring loop)

This program I'm making for a COSC course isn't compiling right, I keep getting the error: Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 2 at java.lang.String.substring( at VowelCount.main( Here's my code:

import ...

2. Java String Function

Describe the following two functions and whether they perform the same task -

public int Jane1(String input, char aChar) {
    int count = 0;
    int index ...

3. Substring indexing

Hello I am writing a method that adds letters to a string. The letters added depends on whether the string begins with a vowel and ends with a consonant. I can check if the string starts with a vowel, because the substring index number is always (0,1). How would I get the substring index number of the last letter since I ...

4. Getting unknown substring from indexes?