/**
* A program designed to crash.
* @author (Mrs O-C)
*/
public class Crasher
{
   private int x;
   private String s;
   private int[][] a;
  /**
   * Constructor for objects of class Crasher
   */
  public Crasher()
   {
     // initialize instance variables
     x = 0;
     s="oops";
     a = new int[5][2];                             // change #1
     for(int i=0;i<a.length;i++){
       for(int j=0;j<a[i].length;j++){
         a[i][j]=x++;
       }
     }
   }
   public void printArray(){
     for(int[] i:a){
       for(int j:i){
         System.out.print(j+" ");
       }
     System.out.println();
     }
   }
 /**
   * An example of a method - how many ways can you make it crash?
   */
   public int badMethod(int y)
   {
     a[y][y]=0;
     return x / y;
   }
   
   public static void main(String[] args){
     Crasher c = new Crasher();
     c.printArray();
     int b = 1;                                 // change #2
     c.badMethod(b);
     //c.badMethod("rats"); // compiler catches this
   
    }
}

What happens if you change #1 to say int[][] a = new int[5][2]? why?
change it back
What happens if you change #2 to say int b=17;? why?