This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi, I went through the sun's explanation, and other links provided in javaranch. For what I understand, the only interest of assertion is debugging. If Your program fails to execute, it will throw an AssertionException, so you will know where it fails to execute! Am I right, or does it have more goals?
By constantly trying one ends up succeeding. Thus: the more one fails the more one has a chance to succeed.
One of the primary tenets of Asserts is that when they are not invoked (like in a production execution) they have a zero impact on execution. They were only intended to be brought into play during testing. This means that you can throw in as many zillion of them as you want - and leave them in the final code - but not worry about how they impact the performance.
"JavaRanch, where the deer and the Certified play" - David O'Meara
Thx everybody for your help, everybody confirms that assertions is a debuging tool. But does it have other interest aspect? I never heard this term :"programming by contract". I am going to find more information about it. Thx for the help and the good links