Which of the following is the most appropriate way to handle invalid arguments in a public method?
java.lang.InvalidArgumentException
. java.lang.IllegalArgumentException
. B.
Assertions should not be used to check preconditions in a public method.
Some kind of runtime exception should be thrown.
IllegalArgumentException is the most appropriate class name for this situation.
There is no such thing as java.lang.InvalidArgumentException
.