public class OutOfBounds { //----------------------------------------------------------------- // Deliberately access an array element that // is out of bounds to produce an exception. //----------------------------------------------------------------- public static void main (String[] args) { int[] a={1, 2, 3, 4, 5}; a[10] = 50; // this causes the exception System.out.println ("This text will NOT be printed."); } }