title: Assertion not working
body: <p>I am trying to write an Assertion to check if the size the user gives is a positive value, if not then make it positive, this statement is inside the class constructor which takes the size value and then makes an array[size]. I have written the below code which i believe to be correct.</p>
  
  <pre><code>    public Grid(int size) {
  
  
      try{
          assert size &gt; 0 ;
      }
      catch(AssertionError e){
          size = Math.abs(size);
      }
  
      setLayout(new GridLayout(size, size));
      grid = new JButton[size][size];
  }
  </code></pre>
  
  <p>Though I never seems to evaluate my assertion and continues the program then causes the NegativeArraySize error( which i am trying to avoid)</p>
  
  <p>I also tried just</p>
  
  <pre><code>assert size&gt;0;
  </code></pre>
  
  <p>And the program fails to stop for negative values..</p>
  
  <p>I have had a few problems with running java on mac recently, so i don't know if my code is right or if it is just one of those odd mac quirks!! and should just use</p>
  
  <pre><code>size=Math.abs(size);
  </code></pre>
  
  <p>Thanks Sam,</p>