• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Assertion Error

 
Abhi vijay
Ranch Hand
Posts: 509
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When classifying Assertion Error as being thrown by the JVM or programmatically, why is it said that its thrown programmatically??? Considering assertion is a runtime mechanism??
 
Punit Singh
Ranch Hand
Posts: 952
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
NumberFormatException, IllegalArgumentException are also runtime mechanism but these are used by java developers in the code.

When you use:


Means you are responsible here to throw AssertionError with message "Illegal value of i".
 
camilo lopes
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
one point important is that assert is not security that always go to run. to exame is very important pay attention in the question with assertion.
but do not forget that "is not security that assertion go to run always".
to happen one AssertionError normally the programmer did some of mistake.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic