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

bookChallenge: Null Reference Handling

Taak

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.

Oplossing

solution.java

solution.java

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 2. Hoofdstuk 5
single

single

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

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

Veeg om het menu te tonen

Taak

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.

Oplossing

solution.java

solution.java

Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 2. Hoofdstuk 5
single

single

some-alt