I’m trying to manually throw an index out of bounds exception for an array.
I know that to throw a regular exception, I can do something like:
if(x>array.length){
throw new Exception("Bad choice!");
}
But how can I do the index out of bounds exception?
Thanks
The API is a very good resource. Checking it before posting a question could save you the time of doing so.