There is a school of thought which says that preconditions should not be checked by assertions. A precondition could be that the state of the object is valid when a method is called, or that the values of the arguments passed to the method are valid . An example is checking that the value passed to a square root method is non-negative. Because assertions can be turned off at runtime the check for a non-negative argument will not occur and the program may crash or silently produce nonsense when supplied with an invalid value. The correct technique, according to Sun, is to throw an exception when an invalid argument value is passed or the state of the object on which the method is called is invalid.
For the
SCJP remember this: do not check method arguments with assertions.