Being Assertive: Using Java Assertions

The programmer is always right—it's the compiler and interpreter that get it wrong! I'm sure you can identify with that thought process. As programmers, we often make assumptions about the values of variables and write code that relies on these assumptions. As much as we hate to admit that we might be wrong in our design or implementation, variables and parameters sometimes don't have the values that we expect.

Code will work properly only as long as the original assumptions that we made when designing and writing it still hold true. If these assumptions are not explicitly stated somewhere, then anyone ...

Get Wicked Cool Java now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.