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

Is jsp front end or backend?

498


Why do we use jstl tags?

499


Which jsp life cycle is in correct order?

508


Can we call servlet from jsp?

473


How do I prevent the output of my jsp or servlet pages from being cached by the browser?

519






What is jsp and its uses?

520


What is page scope?

485


How clear chache and buffer of opera browser.

1935


Explain the difference between servlet and jsp?

541


Which one is correct order of phases in jsp life cycle?

623


How can you avoid scriptlet code in jsp?

521


What are jsp implicit objects?

510


Can an interface be implemented in the jsp file?

513


What is difference between javascript and jsp?

495


Can you explain what is jsp page life cycle?

531