• Post Reply Bookmark Topic Watch Topic
  • New Topic

Assertion  RSS feed

 
Arun Prasath
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Explaine me more deeper about assertion.....
 
wise owen
Ranch Hand
Posts: 2023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check this thread.
 
pascal betz
Ranch Hand
Posts: 547
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why dont you check the online resources http://www.google.ch/search?q=java+assertion first and then ask more detailed ?


perhaps this is a language thing (german is my mother tongue and your name sounds indian to me) but here is how this question sounds to me: "i am lazy and so i try to let someone else do the hard work"

http://catb.org/esr/faqs/smart-questions.html


pascal
 
Adam Nace
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assertion is a very simple idea.

Basically, they are for exceptions that you believe SHOULD never happen but are not sure that they WILL never happen, and which you know will negatively affect the performance of your application if they DO happen. Assertions are not intended to be caught exceptions. They are used in circumstances in which you would not logically be able to react to the exception, and in which the exception should never occur anyway. The assertion immediately halts the application, so that if the exception ever occurs, there is 100% chance that you will know it happened, and you can then go about debugging it.

Assertions are typically useful for ensuring that changes in one section of the codebase will not cause code in other areas of the code base to fail in such cases as class invarients, and method pre or post conditions. Often, assertions will be ignored when the application is actually distributed.

- Adam
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!