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

bookChallenge: Null Reference Handling

Tarefa

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.

Solução

solution.java

solution.java

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 5
single

single

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

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

Deslize para mostrar o menu

Tarefa

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.

Solução

solution.java

solution.java

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 5
single

single

some-alt