posted 21 years ago
If the assertions were not enabled the checks that they perform would not be carried out. However, the argument for public methods still need to be checked.
For a private method, the programmer is responsible of ever calling it with proper arguments. This is so, because the private method is accessible only from within the class declaring them. On the contrary, public methods may be called by any other programmer using the class; and the programmer writing the class has no control over the arguments of those invocations. While debugging, assertions on arguments for private methods are checked. They are only used for debugging. They are not part of the normal operation of the program. The checks on the arguments for public methods need to be performed always however.
SCJP2. Please Indent your code using UBB Code