Assume that command is a variable of type String . Write a statement that throws an Exception with a message “null command” if command is null.
LANGUAGE: JAVA
CHALLENGE:
Assume that command is a variable of type String . Write a statement that throws an Exception with a message “null command” if command is null.
SOLUTION:
if (command==null) throw new Exception("null command");
Posted in Java, Learn To Code