Where we use assertion in java programming?

Answer Posted / saipratapreddy maddireddy

->assertions are using for debugging/ testing the flow of
program at the time of development and testing phases not
yet deployment phase.
we can use the assertions any where in java program is
valid but we have to use it in appropriate way.
->the syntax of Assertion is:
assertion(boolean): value;
*we can take any value after colon(:) that may be int,
char,string and method call
when ever assertion parameter is "true" then it will
proceed the remaining execution of program otherwise it
throw an exception saying"java.lang.AssertionError:xxxx"
assertion for testing purpose if assumption value is
false then it raises an exception but to handling this
exception by using "try-catch-finally" is not recommended.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I maintain session in JSP Page in the bases of user name and password:

581


Why taglib is used in jsp?

520


What is jsp and its architecture?

519


Is jsp platform dependent?

490


What is a scriptlet in jsp and what is its syntax?

487






What is the use of jsp implicit objects?

480


What information is needed to create a tcp socket?

515


How can I override the jspinit() method within a jsp page?

478


How can we disable el?

524


What is a javaserver pages (jsp)?

550


how to insert star image and need to rate it.. one star two star so on how to do in jsp...????

1777


Explain jsp lifecycle methods?

531


How do we prevent browser from caching output of my jsp pages?

499


What's the difference between javabeans and taglib directives?

540


What is _jspservice method?

520