Challenge: Null Reference Handling
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.
Solution
solution.java
Merci pour vos commentaires !
single
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion
Can you explain this in simpler terms?
What are the main takeaways from this?
Can you give me an example?
Awesome!
Completion rate improved to 7.14
Challenge: Null Reference Handling
Glissez pour afficher le menu
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.
Solution
solution.java
Merci pour vos commentaires !
single