title: java.langIndexOutOfBoundException
body: <pre><code> if( (i&lt;1 || i&gt;gridSize) || ( j&lt;1 || j&gt;gridSize ) )
       throw new java.lang.IndexOutOfBoundsException ; 
  </code></pre>
  
  <p>This is a snippet of code from the program I am writing in which ( this is an excercise ) we are asked to throw <code>java.lang.IndexOutOfBoundsException</code> if the index <code>i</code> is out of the grid . But when I compile it shows the following error . 
  3 errors found:</p>
  
  <pre><code>File: C:\Users\das\Desktop\Percolation.java  [line: 19]
  Error: Syntax error on token(s), misplaced construct(s)
  </code></pre>
  
  <p>How can I correct it ? </p>