what is Assertion?

Answer Posted / raja moram

The concept of suspending the execution of a function based
on the user defined condition is known as ASSERTION.
We implement the concept of Assertions using 'assert' keyword.
We use 'assert' keyword by mentioning a condition, if the
mentioned condition is not satisfied the 'assert' keyword
suspends the execution of the method in the middle and
transfers the control along with the 'AssertionError' class
object to the calling place.
Here 'AssertionError' is the subclass of 'Error'class.
To enable Assertions application:
java -ea <className>
This concept of ASSERTIONS is introduced from JDK 1.5 onwards

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the main use of generics in java?

507


why we use merge option in hybernate pls give a ex snippet

1453


Is 9 a prime number?

462


Is ++ operator is thread safe in java?

513


What about features of local inner class?

613






Justify your answer that you can't define a method inside another method in java, if you can then how?

600


What is the difference between the boolean & operator and the && operator in java programming?

562


What are the types of methodology?

506


What is package private scope in java?

531


What is javac in java?

558


How finally used under exception handling?

510


What is method overloading and method overriding?

535


Which method must be implemented by all threads?

717


What is an immutable object?

578


What is static in java?

555