Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Assertions in Java  RSS feed

 
Glenny Dsilva
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do we show assertions on the console.

 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Disappointingly, not an Advanced question. I was all up for a discussion on one of my favourite topics, but no, it's just another mis-post...

Read up on what assertions do in Java. If an assertion fires, it throws an AssertionError. What happens after that depends on what your program does with Errors.
 
Raees Uzhunnan
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
error is a subclass of throwable, but by java norms unlike exceptions you should not try to recover from an error ; because this might put your app to a an abnormal condition.

Raees
[ October 09, 2007: Message edited by: RAEES UZHUNNAN ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!