X1281: Replace Spaces

Write a method replaceSpaceUnderscore that replaces all spaces with _ (underscores) in the String sentence.

Examples:

replaceSpaceUnderscore("to live and to love") -> "to_live_and_to_love"
replaceSpaceUnderscore("Don't Have a Cow, Man") -> "Don't_Have_a_Cow,_Man"

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.