Question: Repeat the previous exercise, but find the second word in the string. Previous exercise Write some Java statements that use the String methods indexOf and
Repeat the previous exercise, but find the second word in the string.
Previous exercise
Write some Java statements that use the String methods indexOf and substring to find the first word in a string. We define word to be a string of characters that does not include whitespace. For example, the first word of the string
"Hello, my good friend!"
is the string "Hello,"and the second word is the string "my".
Step by Step Solution
3.46 Rating (178 Votes )
There are 3 Steps involved in it
sentence sentencetrim int space sentenceindex... View full answer
Get step-by-step solutions from verified subject matter experts
