Limited access

Upgrade to access all content for this subject

Of the following situations, which would be the best example of when you should consider throwing an IllegalArgumentException within your code?

A

Your method accepts an object as its parameter and the object has not been instantiated.

B

Your method accepts an integer parameter that needs to be within a specific range and the parameter is outside of that range.

C

The parameters required by the class’ constructor method do not match the parameters when instantiating the object from another class.

D

Your method requires a String as its parameter and it is passed an integer.

E

Your method is supposed to return a positive integer, but it is returning a negative number.

Select an assignment template