Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes AssertionError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "AssertionError" Watch "AssertionError" New topic
Author

AssertionError

joshua antony
Ranch Hand

Joined: Jun 05, 2006
Posts: 117
To discourage you from trying
to substitute an assertion for an exception, the AssertionError doesn't provide
access to the object that generated it. All you get is the String message.

Above is from K&B.
I am not able to understand it.
Can somebody please explain the same with some example
wise owen
Ranch Hand

Joined: Feb 02, 2006
Posts: 2023
Programming With Assertions

Access to these objects would encourage programmers to attempt to recover from assertion failures, which defeats the purpose of the facility.
joshua antony
Ranch Hand

Joined: Jun 05, 2006
Posts: 117
Hi wise,

Thanks for your reply.
My problem is basically with the line the AssertionError doesn't provide
access to the object that generated it


In the below code, the access to which object is not provided?
 
 
subject: AssertionError