Challenge: Null Reference Handling
Aufgabe
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.
Lösung
solution.java
War alles klar?
Danke für Ihr Feedback!
Abschnitt 2. Kapitel 5
single
Fragen Sie AI
Fragen Sie AI
Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen
Awesome!
Completion rate improved to 7.14
Challenge: Null Reference Handling
Swipe um das Menü anzuzeigen
Aufgabe
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.
Lösung
solution.java
War alles klar?
Danke für Ihr Feedback!
Abschnitt 2. Kapitel 5
single