Where we use assertion in java programming?

Answers were Sorted based on User's Feedback



Where we use assertion in java programming?..

Answer / 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

Where we use assertion in java programming?..

Answer / mariyap

Only we used in try block

Is This Answer Correct ?    2 Yes 11 No

Post New Answer

More JSP Interview Questions

What is jsp and how it works?

0 Answers  


what are the alternate way to use the scriplet in jsp.

1 Answers  


What is JSP?

3 Answers  


What is asp and jsp?

0 Answers  


How do I use sendredirect?

0 Answers  






Can we use methods in JSP? If so where the methods are stored in servlet class file?

6 Answers   Bodhtree, Cognizant, Persistent, TCS,


what is difference between redirect and forward method?

12 Answers   Polaris, TCS, Wipro,


How can we use beans in jsp?

0 Answers  


Mention some important jsp action tags.

0 Answers  


What is the different between servlet and struts

2 Answers  


How does el search for an attribute?

0 Answers  


What do you mean by context initialization parameters?

0 Answers  


Categories