Skip to content

Instantly share code, notes, and snippets.

@uncoded-ro
Created January 12, 2020 07:14
Show Gist options
  • Save uncoded-ro/6cc48ec813883ed5b8fff71e0173d5c7 to your computer and use it in GitHub Desktop.
Save uncoded-ro/6cc48ec813883ed5b8fff71e0173d5c7 to your computer and use it in GitHub Desktop.
package ro.virtualcampus.exceptii;
public class Exceptie2 {
public static void main(String[] args) {
int tablou[] = { 2, 4, 5, 1 };
int index = 3;
if (index >= tablou.length || index < 0)
System.out.println("indexul [" + index + "] depaseste marginile tabloului");
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