This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Can we throw assertion error explicitily Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Can we throw assertion error explicitily" Watch "Can we throw assertion error explicitily" New topic
Author

Can we throw assertion error explicitily

ramesh maredu
Ranch Hand

Joined: Mar 15, 2008
Posts: 210

I have a query regarding the statement mentioned below, this is taken from master exam that i downloaded.

Never throw assertion error explicitly


the answer says above statement is incorrect.But i feel we should not throw it explicitly.


SCJP 1.5 94%.
The greatest glory in living lies not in never falling, but in rising every time we fall.
Poornima Sharma
Ranch Hand

Joined: Sep 09, 2008
Posts: 114
Yes, we can throw Its just like runtime exception (Every Error) you can catch it if you want. If you dont want to catch then it will be propogated upward.


Poornima Sharma
SCJP 6.0
ramesh maredu
Ranch Hand

Joined: Mar 15, 2008
Posts: 210

I know we can throw it like any other exception but is it proper way of doing.
[ September 30, 2008: Message edited by: ramesh maredu ]
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Was the question "Can we throw assertion error explicitily ?", or "Is it a good practice to throw an assertion error ?".


[My Blog]
All roads lead to JavaRanch
ramesh maredu
Ranch Hand

Joined: Mar 15, 2008
Posts: 210

the question was "what are true?" the statement i mentioned was one option among five.

will there be any specific wording to indicate whether it is legal or proper?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can we throw assertion error explicitily
 
Similar Threads
Doubt in K&B SCJP 6: topic: AssertionError Source
what is assertion error
Question on Assertion from KnB's CD
Assertions
Master exam question on assertion