Here's the to the final exam (in-class, written) problem.
Clearly the name of the custom-bash-4.2$ nano -w CrazyWorldException.java -bash-4.2$ nano -w LispList.java -bash-4.2$ nano -w EmptyList.java -bash-4.2$ nano -w NonEmptyList.java -bash-4.2$ nano -w Test.java -bash-4.2$ javac *.java -bash-4.2$ java Test [] ... expected: [] 0 ... expected: 0 false ... expected: false A ... expected: A 1 ... expected: 1 false ... expected: false true ... expected: true A B C ... expected: A B C 3 ... expected: 3 false ... expected: false true ... expected: true true ... expected: true false ... expected: false J B M J Q ... expected: J B M D Q 5 ... expected: 5 true ... expected: true false ... expected: false We should never ask for that... CrazyWorldException -bash-4.2$
Exception
class is made up (use your own).
Furthermore you can use the UnsupportedOperationException
as the book suggests.