Assertion
A development-time check that reports when an expected condition is false.
What is Assertion in Java?
Assertion — A development-time check that reports when an expected condition is false.
class Inventory {
void checkQuantity(int quantity) {
assert quantity >= 0 : "quantity cannot be negative";
}
}
Level: Journeyman · More Java terms at this level
Updated