Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Oppiskele Challenge: Filter Failure Messages | String
Java Basics
course content

Kurssisisältö

Java Basics

Java Basics

1. Getting Started
2. Basic Types and Operations
3. Loops
4. Arrays
5. String

book
Challenge: Filter Failure Messages

Tehtävä

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. Loop through the logs array and check each message for the presence of the keyword "failure" (case-insensitive).
  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.

Ratkaisu

java

solution

Switch to desktopVaihda työpöytään todellista harjoitusta vartenJatka siitä, missä olet käyttämällä jotakin alla olevista vaihtoehdoista
Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 5. Luku 4
toggle bottom row

book
Challenge: Filter Failure Messages

Tehtävä

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. Loop through the logs array and check each message for the presence of the keyword "failure" (case-insensitive).
  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.

Ratkaisu

java

solution

Switch to desktopVaihda työpöytään todellista harjoitusta vartenJatka siitä, missä olet käyttämällä jotakin alla olevista vaihtoehdoista
Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 5. Luku 4
Switch to desktopVaihda työpöytään todellista harjoitusta vartenJatka siitä, missä olet käyttämällä jotakin alla olevista vaihtoehdoista
Pahoittelemme, että jotain meni pieleen. Mitä tapahtui?
some-alt