Challenge: Uppercase Even Words
Task
Swipe to start coding
Your task is to convert each word at an even position to uppercase and return the modified string.
- Split the input string into an array of words using the
split(" ")
method from the String class. - Create an object for building the result string step by step using the
StringBuilder
class. - Loop through all elements of the
array
. - Inside the loop, check if the index is even using the remainder operator
%
with 2. - If the index is even, convert the corresponding word to uppercase using the
toUpperCase()
method. - If the index is odd, append the word as is.
- After the loop, convert the result to a string using the
toString()
method.
Solution
solution.java
Everything was clear?
Thanks for your feedback!
SectionΒ 3. ChapterΒ 3
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 2.63Awesome!
Completion rate improved to 2.63
Challenge: Uppercase Even Words
Task
Swipe to start coding
Your task is to convert each word at an even position to uppercase and return the modified string.
- Split the input string into an array of words using the
split(" ")
method from the String class. - Create an object for building the result string step by step using the
StringBuilder
class. - Loop through all elements of the
array
. - Inside the loop, check if the index is even using the remainder operator
%
with 2. - If the index is even, convert the corresponding word to uppercase using the
toUpperCase()
method. - If the index is odd, append the word as is.
- After the loop, convert the result to a string using the
toString()
method.
Solution
solution.java
Everything was clear?
Thanks for your feedback!
SectionΒ 3. ChapterΒ 3
single
Awesome!
Completion rate improved to 2.63
Challenge: Uppercase Even Words
Swipe to show menu
Task
Swipe to start coding
Your task is to convert each word at an even position to uppercase and return the modified string.
- Split the input string into an array of words using the
split(" ")
method from the String class. - Create an object for building the result string step by step using the
StringBuilder
class. - Loop through all elements of the
array
. - Inside the loop, check if the index is even using the remainder operator
%
with 2. - If the index is even, convert the corresponding word to uppercase using the
toUpperCase()
method. - If the index is odd, append the word as is.
- After the loop, convert the result to a string using the
toString()
method.
Solution
solution.java
Everything was clear?
Thanks for your feedback!