aspose file tools*
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
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?
 
 
subject: Can we throw assertion error explicitily