• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Assertions

 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Oh. Hi guys! Look at this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic