title: How to enable assert statement to execute?
body: <p>I've written the following code:</p>
  
  <pre><code>class Cl
  {
      public static void main (String[] args) throws java.lang.Exception
      {
          assert true; //1
          Bar.foo();
      }
  
      static class Bar{
          public static void foo(){
              boolean enabled = false;
              assert enabled = true;
              System.out.println("Asserts " + 
                 (enabled ? "enabled" : "disabled"));
          }
      }
  }
  </code></pre>
  
  <p><strong><a href="http://ideone.com/5E8Vb1" rel="nofollow">DEMO</a></strong></p>
  
  <p><a href="http://docs.oracle.com/javase/specs/jls/se8/html/jls-14.html#jls-14.10" rel="nofollow">JLS 14.10</a> says:</p>
  
  <blockquote>
    <p>An assert statement that is executed after its class has completed
    initialization is enabled if and only if the host system has
    determined that the top level class that <em>lexically contains the assert</em>
    <em>statement</em> enables assertions.</p>
  </blockquote>
  
  <p>I thought I enabled assertion by assert true in <code>Cl</code> class, but it's still not working. How can I enable an assertion regarding to what <code>JLS</code> said?</p>