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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!