セクション 3. 章 3
single
Challenge: Uppercase Even Words
メニューを表示するにはスワイプしてください
タスク
スワイプしてコーディングを開始
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
StringBuilderclass. - 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.
解答
すべて明確でしたか?
フィードバックありがとうございます!
セクション 3. 章 3
single
AIに質問する
AIに質問する
何でも質問するか、提案された質問の1つを試してチャットを始めてください