Friday, May 11, 2007

When assertions should be avoided?

In following situations the assertions should be avoided:
-When assertion becomes a performance issue.It means an assertion should not include too complex logic equalling implementation of a method.
-Do not use assertions in argument checking of public methods.As argument checking is part of a method implementation and if these arguments are erroneous then it will throw runtime exception and assertion failure will not result in any error.



Interview Questions On Java,Java EE Copyright © 2017. Reads: best tracker