Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Oppiskele Challenge: Null Reference Handling | Reference Types and Strings
Java Data Types

bookChallenge: Null Reference Handling

Tehtävä

Swipe to start coding

Write a method to safely check if a string is null or empty, and return a suitable message for each case.

  • If the string is null, return: Input is null.
  • If the string is empty, return: Input is empty.
  • If the string contains text, return: Input is: <value> (replace <value> with the actual string value).

Call this method from the main method with at least one example of each case, and print the returned result.

Ratkaisu

solution.java

solution.java

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 2. Luku 5
single

single

Kysy tekoälyä

expand

Kysy tekoälyä

ChatGPT

Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme

Suggested prompts:

Can you explain this in simpler terms?

What are the main takeaways from this?

Can you give me an example?

close

Awesome!

Completion rate improved to 7.14

bookChallenge: Null Reference Handling

Pyyhkäise näyttääksesi valikon

Tehtävä

Swipe to start coding

Write a method to safely check if a string is null or empty, and return a suitable message for each case.

  • If the string is null, return: Input is null.
  • If the string is empty, return: Input is empty.
  • If the string contains text, return: Input is: <value> (replace <value> with the actual string value).

Call this method from the main method with at least one example of each case, and print the returned result.

Ratkaisu

solution.java

solution.java

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 2. Luku 5
single

single

some-alt