Challenge: Null Reference Handling
Tarea
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.
Solución
solution.java
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 2. Capítulo 5
single
Pregunte a AI
Pregunte a AI
Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla
Awesome!
Completion rate improved to 7.14
Challenge: Null Reference Handling
Desliza para mostrar el menú
Tarea
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.
Solución
solution.java
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 2. Capítulo 5
single