Question: Implement the following method so that it returns the index of the last space ( ) in the string. For example: If we call this
Implement the following method so that it returns the index of the last space (" ") in the string.
For example:
- If we call this method with the string "I'm making Waffles", this method would return 10, which is the index of the " " character between the 'g' in "making" and the 'W' in "Waffles".
public int indexOfLastSpace(String phrase)
{
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
