Forums Register Login

Assertions

+Pie Number of slices to send: Send
Hi folks,
Could I use Assertions in my Assignment?
I think is great!
Best regards,
Wilder C. Rodrigues
Sun Certified Programmer for Java 2 - Platform 1.4
+Pie Number of slices to send: Send
Hi Wilder,
I hope we can
There have been several places in the assignment where I have used assertions as the first line in an Exception handler to indicate that the scenario should never occur. It is great - the assertion effectively comments the code while actually doing something useful! I still have code afterwards to handle the exception, but the assertion makes it very clear to anyone reading my code what my opinion of the chances of the exception occuring are.
Funny though - I hated assertions in C - there was no way to switch them off (without a recompile), and they provided little help (unless you also had core dumps). But in Java they are cool.
Regards, Andrew
Danger, 10,000 volts, very electic .... tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 584 times.
Similar Threads
assertions
What does the java runtime option -cs do?
assertion code overhead when disabled
Pointers
Exam for JDK1.4
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 09:13:57.