aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Assertions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Assertions" Watch "Assertions" New topic
Author

Assertions

Wilder C Rodrigues
Ranch Hand

Joined: May 03, 2003
Posts: 107
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


SCEA Part I, SCAJ, SCPJ, SCDJ, SCWCD, SCBCD, SCMAD<br /> <br />"The significant problems we face can not be solved at the same level of thinking we were at when we created them." - Albert Einstein
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11430
    
  85

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


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Assertions