What is the difference between Assertion and Exception?

Questions by sujatham   answers by sujatham

Showing Answers 1 - 3 of 3 Answers


  • Aug 7th, 2007

Assertion specifies some condition that should be true during execution of a program. Assertion are of two types. pre assertion and post assertion.

Exception are the mild error condition that your program should encounter during a program run.for example divide by zero.


  • Aug 21st, 2008

Exception is a mechanism used by many programming language to describe what to do when something unexpected happens.Assertion is the way to test the certain assumptions about the logic of your program.

  Was this answer useful?  Yes

There is no concept called Assertion present in Java. Exception is the program error which arises due to uncontrolable condition. This condition can be arised automatically from to program code(Eg. DataBase Connectivity, File handling) or condition can be customized and customized exception can be thrown.


If there is a concept called Assertion, please write about it

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions