-
-
Save uncoded-ro/cdd6e220fa424bccd1208fd1423401e8 to your computer and use it in GitHub Desktop.
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
package ro.virtualcampus.exceptii; | |
public class Exceptie2 { | |
public static void main(String[] args) throws IndexOutOfBoundsException { | |
int tablou[] = { 2, 4, 5, 1 }; | |
int index = 5; | |
if (index >= tablou.length || index < 0) | |
throw new ArrayIndexOutOfBoundsException(); | |
else | |
System.out.println("elementul tablou[" + index + "] este " + tablou[index]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment