Skip to content

Instantly share code, notes, and snippets.

@DavidMah
Created October 5, 2011 00:57
Show Gist options
  • Save DavidMah/1263322 to your computer and use it in GitHub Desktop.
Save DavidMah/1263322 to your computer and use it in GitHub Desktop.
throwing an exception
public class experiment {
public static void main(String[] args) {
throw new ArrayIndexOutOfBoundsException();
}
}
@DavidMah
Copy link
Author

DavidMah commented Oct 5, 2011

You can put in any exception instead of ArrayIndexOutOfBoundsException if it is defined already. Notice the new there -- you're actually running the constructor of a class called ArrayIndexOutOfBoundsException

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment