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

Can you disable the caching on the back button of a particular browser?

735


How can we extend jsp technology?

864


How clear chache and buffer of opera browser.

2149


Define JSP Scriptlet.

760


When will container initialize multiple jsp/servlet objects?

744


Why do we need custom tags?

694


What does .com stand for?

658


How can we forward the request from jsp page to the servlet?

732


What is jsp standard tag library, provide some example usage?

714


Can I use javascript on jsp page?

700


Why we use jsp instead of html?

717


What is jsp index?

693


What is session setattribute?

672


How we can use javascript with jsp pages?

711


What is a javaserver pages (jsp)?

759