Created
December 19, 2023 17:31
-
-
Save mounicasrinivas/c0fe0361c0e60689668e3b44bd2511f4 to your computer and use it in GitHub Desktop.
ArrayIndexOutOfBoundsException
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int[] myArray = {10, 20, 30, 40, 50}; | |
// Accessing a valid index | |
int validElement = myArray[2]; | |
// Attempting to access an invalid index (outside bounds) | |
// This would throw an ArrayIndexOutOfBoundsException | |
int invalidElement = myArray[5]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment