113k views
2 votes
JAVA

In this exercise, you are given a word or phrase and you need to return that word or phrase with the word ‘like’ in front of it.

If the phrase already starts with like, you should not add another one, just return the phrase as is.

Example:

like("totally awesome") --> "like totally awesome"
like("like cool dude") --> "like cool dude"
like("I like you") -->"like I like you"

User Selbie
by
5.9k points

1 Answer

3 votes

Answer:

Answer in the screenshot provided.

Step-by-step explanation:

Check if the String starts with like. If it does not then prepend it.

JAVA In this exercise, you are given a word or phrase and you need to return that-example-1
User Carlos Villalba
by
6.2k points