Multiple Choices
Answer (Choose 1 answer)
Which of the following is the most appropriate way to handle invalid arguments in a public method?
A. Throw java.lang.InvalidArgumentException.
B. Throw java.lang.IllegalArgumentException.
C. Check for argument validity in an assert statement, which throws AssertionError when the arguments are invalid.
D. Use non-assert code to check for argument validity. If invalid arguments are detected, explicitly throw AssertionError.