| 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
|
|
|