Question: Hello I Need help modifying my ArrayIndexOutOfBoundsExceptionProgram. It keeps saying that I cannot have a static main method. Thank you. public class ArrayIndexOutOfBoundsExceptionThrown { ArrayIndexOutOfBoundsExceptionThrown()

Hello I Need help modifying my ArrayIndexOutOfBoundsExceptionProgram. It keeps saying that I cannot have a static main method. Thank you.

public class ArrayIndexOutOfBoundsExceptionThrown {

ArrayIndexOutOfBoundsExceptionThrown() {

throw new ArrayIndexOutOfBoundsException ("Array Index Out Of Bounds Exception");

}

class program {

public static void main (String args [])

try {

ArrayIndexOutOfBoundsExceptionThrown e = new ArrayIndexOutOfBoundsExceptionThrown();

} // try closed

catch (ArrayIndexOutOfBoundsException ex){

ArrayIndexOutOfBoundsExceptionCatch c = new ArrayIndexOutOfBoundsExceptionCatch(ex);

} // catch closed

} // main closed

} // class closed

}

public class ArrayIndexOutOfBoundsExceptionCatch {

ArrayIndexOutOfBoundsExceptionCatch (ArrayIndexOutOfBoundsException exception) {

System.out.println("Caught inside ArrayIndexOutOfBoundsException");

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!