Created
April 24, 2015 17:41
-
-
Save ZhdanRuslan/daf20887231553ef9500 to your computer and use it in GitHub Desktop.
com.javarush.test.level09.lesson06.task03
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 com.javarush.test.level09.lesson06.task03; | |
/* Исключение при работе с массивами | |
Перехватить исключение (и вывести его на экран), указав его тип, возникающее при выполнении кода: | |
int[] m = new int[2]; | |
m[8] = 5; | |
*/ | |
public class Solution | |
{ | |
public static void main(String[] args) throws Exception | |
{ | |
try | |
{ | |
int[] m = new int[2]; | |
m[8]= 5; | |
} catch (ArrayIndexOutOfBoundsException exc){ | |
System.out.println(exc); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment