This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes MasterExam question on Assertions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "MasterExam question on Assertions" Watch "MasterExam question on Assertions" New topic
Author

MasterExam question on Assertions

Simran Dass
Ranch Hand

Joined: Jan 09, 2010
Posts: 183
The question is : -

Which statements are ture? I cannot understand why the following statement is FALSE
"Never throw an AssertionError explicitly."

According to me it should be True


Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

I have edited your message. Please KeepItDown.


[My Blog]
All roads lead to JavaRanch
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

According to me it should be True


Why do you want to throw errors in your program when calling assert condition; will suffice ?


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Simran Dass
Ranch Hand

Joined: Jan 09, 2010
Posts: 183

Deepak that is what I'm saying.
Why would I want to throw AssertionError explicitly. This is why the statement :-

"Never throw an AssertionError explicitly " should be true.
Neha Daga
Ranch Hand

Joined: Oct 30, 2009
Posts: 504
yup, I agree with simran.


SCJP 1.6 96%
Simran Dass
Ranch Hand

Joined: Jan 09, 2010
Posts: 183



for Neha .
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

I guess I misread your question. Yes, Errors are not meant to be thrown explicitly
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: MasterExam question on Assertions