title: I want my array value to catch an exception in java
body: <p>I need some help on arrays. My question is that I created an integer array that has 100 elements. If the user inputs a value bigger then 100, java throws an exception. I want the user to be allowed to enter more then 100 in the array and the ArrayOutOfBoundsException is thrown at the user. I have the code here: </p>
  
  <p><em>edit</em> I forgot to ask if i got the array with a sub array correct. By the way, i want this done in plain arrays not ArrayList.</p>
  
  <pre><code>public class Lab6
  {
      public static void main(String[] args)throws IOException, NullPointerException, ArrayIndexOutOfBoundsException
      {       
          //the memory with 100 elements
          int[] vMem = new int[100];
          //the memory with 1000 elements
          int[][] vTopMem = new int[1000][];
          vTopMem[0] = vMem; 
          System.out.println("Enter an integer: ");
          File vMemory = new File("file name and location");
          RandomAccessFile storeMem = new RandomAccessFile(vMemory, "rw");
          Scanner input = new Scanner(System.in);
          while(true)
          {
                  for(int i = 0; i &lt; vMem.length; i++)
              {
                      vMem[i] = input.nextInt();
                      storeMem.write(i);
                      if(i &gt; vMem.length)
                      {
                       System.out.println("out of bounds!");  
                      }
              }
          }
      }
  }
  </code></pre>