Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Question: What is the purpose of the 'Assertion' in Java?
Answer: Assertions are used to test assumptions about the program. They help in identifying logical errors during development and testing.

Example:

assert x > 0 : "x should be greater than 0";
Is it helpful? Yes No

Most helpful rated by users:

©2026 WithoutBook