With regard to String handling in Java. The Funworks Java textbook, Learning Unit 1 (Characters and Strings) has exercise 3.3 on page 19.
In this exercise you are required to write Java String handling code that will . . .
- Ask the user for a word, phrase or sentence.
- Find the first and last characters of the String.
- Print the String backwards.
- Sequentially harvest letters from the front and the end of the String until there are no more letters left.
- Find the middle character or two characters of the String if it has an even number of characters.
- Print out only the vowels in a String.
- Count the number of spaces in a String.
To do this one needs the following String handling methods – length, charAt, substring, indexOf, contains which are used used with conditional statements and for loops.