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

What is application scope in jsp?

519


What is pagecontext?

526


What are the different scopes an object can have in a jsp page?

531


What is jsp application?

508


What are stored procedures? How is it useful?

518






What are the jsp tag?

547


What is jstl (jsp standard tag library)?

545


How can I extend the functionality of jsp?

515


How can I implement a thread-safe jsp page? What are the advantages and disadvantages of using it?

519


What is attribute in jsp?

523


How to include static files in a JSP page?

575


mention the three important tags used in the development of jsp bean.

492


Is jsp and javascript same?

502


What is the difference between include directive and include action?

518


What is a jsp directive?

476