Challenge: Filter Failure Messages
Task
Swipe to start coding
Imagine you have a list of system messages, and you need to extract only those containing the word "failure".
Write a program that creates a new array with only these messages and then prints them to the console.
- Loop through the
logsarray and check each message for the presence of the keyword "failure" (case-insensitive). - Count how many messages contain the word "failure" and store the result in a variable
count. - Loop through the
logsarray again, and add only the messages containing "failure" into theerrorLogsarray.
Solution
solution.java
Everything was clear?
Thanks for your feedback!
SectionΒ 5. ChapterΒ 4
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 2.7
Challenge: Filter Failure Messages
Swipe to show menu
Task
Swipe to start coding
Imagine you have a list of system messages, and you need to extract only those containing the word "failure".
Write a program that creates a new array with only these messages and then prints them to the console.
- Loop through the
logsarray and check each message for the presence of the keyword "failure" (case-insensitive). - Count how many messages contain the word "failure" and store the result in a variable
count. - Loop through the
logsarray again, and add only the messages containing "failure" into theerrorLogsarray.
Solution
solution.java
Everything was clear?
Thanks for your feedback!
SectionΒ 5. ChapterΒ 4
single