The real reason assertions don't work like ordinary Exceptions is that you aren't supposed to use assertions in real life. They are for
testing. You put lots of assertions in your code, run it, and wherever you get an AssertionError you have found a vulnerability. You then put an ordinary throw statement and an ordinary Exception in the code there.
If you run that without assertions you will never know somebody has passed a ridiculous argument to the heat method, and violated the class invariant. If you run it with -ea you will get the error. You then add the following if statement to the beginning of the heat method
[edit]Moved assertion around to correct syntax error[/edit]
[ October 24, 2008: Message edited by: Campbell Ritchie ]