aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Assertion doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Assertion doubt" Watch "Assertion doubt" New topic
Author

Assertion doubt

Ash Gill
Ranch Hand

Joined: Jun 30, 2011
Posts: 71
i am trying to get an assertion error, however, When i compile my program from the command line, the assertion error is never thrown and the program compiles fine



can anyone help to figure out that why isn't the assertion error thrown anywhere in the above code.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Ash Gill wrote:i am trying to get an assertion error, however, When i compile my program from the command line, the assertion error is never thrown and the program compiles fine

AssertionError is a RuntimeException. exception always throws at runtime. so what happend when you run the program with -ea flag? i.e, java -ea YourApp.

note: by default assertion is disabled!
Ash Gill
Ranch Hand

Joined: Jun 30, 2011
Posts: 71
yes, they work fine. thanks a lot. i was getting the concept wrong, good that i tried out an example.
 
I agree. Here's the link: jrebel
 
subject: Assertion doubt
 
Similar Threads
on assertions
Simple question on assertion
Regarding to assertions
doubt :assertion errors
Assertion