© Kishori Sharan 2017

Kishori Sharan, Beginning Java 9 Fundamentals, https://doi.org/10.1007/978-1-4842-2902-6_14

14. Assertions

Kishori Sharan

(1)Montgomery, Alabama, USA

In this chapter, you will learn:

  • What an assertion is in Java

  • How to use assertions in Java programs

  • How to enable and disable assertions

  • How to check the status of an assertion

All classes in this chapter are members of a jdojo.assertion module, as declared in Listing 14-1.

Listing 14-1. The Declaration of a jdojo.assertion Module
// module-info.javamodule jdojo.assertion {    exports com.jdojo.assertion;}

What Is an Assertion?

The literal meaning of assertion is to state something in a strong, confident , and forceful way. When you assert “something,” you believe that “something” to ...

Get Beginning Java 9 Fundamentals: Arrays, Objects, Modules, JShell, and Regular Expressions 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.