Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Uppercase Even Words | String Advanced
Java Extended

Swipe to show menu

book
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.

  1. Split the input string into an array of words using the split(" ") method from the String class.
  2. Create an object for building the result string step by step using the StringBuilder class.
  3. Loop through all elements of the array.
  4. Inside the loop, check if the index is even using the remainder operator % with 2.
  5. If the index is even, convert the corresponding word to uppercase using the toUpperCase() method.
  6. If the index is odd, append the word as is.
  7. After the loop, convert the result to a string using the toString() method.

Solution

solution.java

solution.java

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 3
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

close

Awesome!

Completion rate improved to 2.63

book
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.

  1. Split the input string into an array of words using the split(" ") method from the String class.
  2. Create an object for building the result string step by step using the StringBuilder class.
  3. Loop through all elements of the array.
  4. Inside the loop, check if the index is even using the remainder operator % with 2.
  5. If the index is even, convert the corresponding word to uppercase using the toUpperCase() method.
  6. If the index is odd, append the word as is.
  7. After the loop, convert the result to a string using the toString() method.

Solution

solution.java

solution.java

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

close

Awesome!

Completion rate improved to 2.63

Swipe to show menu

some-alt