<p>I'm wondering why the <code>assert</code> keyword is so underused in Java? I've almost never seen them used, but I think they're a great idea. I certainly much prefer the brevity of:</p>

<pre><code>assert param != null : "Param cannot be null";
</code></pre>

<p>to the verbosity of:</p>

<pre><code>if (param == null) {
    throw new IllegalArgumentException("Param cannot be null");
}
</code></pre>

<p>My suspicion is that they're underused because</p>

<ul>
<li>They arrived relatively late (Java 1.4), by which time many people had already established their Java programming style/habit</li>
<li>They are turned off at runtime by default</li>
</ul>

In fact they arrived in Java 1.4.
I think the main problem is that when you code in an environment where you do not manage JVM options directly by yourself like in
Eclipse
or J2EE servers (in both cases it is possible to change JVM options, but you need to deeply search to find where it can be done), it is easier (I mean it requires less effort) to use
```
if
```
and exceptions (or worse not to use anything).