It is sometimes good practice to throw an AssertionError explicitly.
hmm.. I don't quite get that one.. can any one elaborate it please?
I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
Joined: Nov 27, 2001
how about when your program should not reach that a particular point in your code... so you directly call assert false; You know for sure that it must throw an AssertionError because it reached that point... am I right?
Hi Andres It is sometimes advisable to throw AssertionError explictily becasue the assertions can be disabled at runtime. Answer to you question "why not simply use assert false;" is also the same i.e. assert false; may be disabled at runtime. So in case you want that this point in the program should never ever be reached then you can throw an assertion error.