R
richnjones
Hello,
I was thinking about assertions in java and I dont really understand
why they are needed. I have read the article on the sun web site.
http://java.sun.com/j2se/1.4.2/docs/guide/lang/assert.html
and perhaps Im being tired but I dont see why you cannot just throw
runtime exceptions
why is
assert true;
better than
if (true)
throw new RuntimeException(...)
am I missing something? I know C++ makes use of assertions. Is this
because they dont have built-in exceptions?
Thanks for any help
Richard
I was thinking about assertions in java and I dont really understand
why they are needed. I have read the article on the sun web site.
http://java.sun.com/j2se/1.4.2/docs/guide/lang/assert.html
and perhaps Im being tired but I dont see why you cannot just throw
runtime exceptions
why is
assert true;
better than
if (true)
throw new RuntimeException(...)
am I missing something? I know C++ makes use of assertions. Is this
because they dont have built-in exceptions?
Thanks for any help
Richard