Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Challenge: Filter Failure Messages | Section
Java Fundamentals

bookChallenge: Filter Failure Messages

Aufgabe

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.

  1. In the extractFailureLogs() method, loop through the logs array and check each message for the presence of the keyword "failure" (case-insensitive, using the toLowerCase() method).
  2. Count how many messages contain the word "failure" and store the result in a variable count.
  3. Loop through the logs array again, and add only the messages containing "failure" into the errorLogs array.

Lösung

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 32
single

single

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

close

bookChallenge: Filter Failure Messages

Swipe um das Menü anzuzeigen

Aufgabe

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.

  1. In the extractFailureLogs() method, loop through the logs array and check each message for the presence of the keyword "failure" (case-insensitive, using the toLowerCase() method).
  2. Count how many messages contain the word "failure" and store the result in a variable count.
  3. Loop through the logs array again, and add only the messages containing "failure" into the errorLogs array.

Lösung

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 32
single

single

some-alt