Hi steve. All you need to do is:
public class StringTooLongException extends Exception {
public StringTooLongException(String message) {
throw new IllegalArgumentException("Exception: String too long.");
}
}
With this, the output is below on an input of "Hello":
But on input longer than 32 you see this:
123456789012345678901234567890123
Exception in thread "main" java.lang.IllegalArgumentException: Exception: String too long.
at StringTooLongException.<init>(StringTooLongExcepti on.java:4)
at TooLongCrashes.main(TooLongCrashes.java:17)
Java Result: 1
Should this satisfy your question, please mark this thread as 'Solved', if not, definitely let us assist with more on this topic.
My bad.. I didn't see that it actually worked before I made an adjustment.. so, basically you picked up another way to throw an exception.
