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
Get step-by-step solutions from verified subject matter experts
