Advertisement
jaVer404

level09.lesson06.task03

Apr 26th, 2015
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1. package com.javarush.test.level09.lesson06.task03;
  2.  
  3. /* Исключение при работе с массивами
  4. Перехватить исключение (и вывести его на экран), указав его тип, возникающее при выполнении кода:
  5. int[] m = new int[2];
  6. m[8] = 5;
  7. */
  8.  
  9. public class Solution
  10. {
  11.     public static void main(String[] args) throws Exception
  12.     {
  13.         //Напишите тут ваш код
  14.         try
  15.         {
  16.  
  17.             int[] m = new int[2];
  18.             m[8] = 5;
  19.         }
  20.         //Напишите тут ваш код
  21.         catch (Exception e) {
  22.             System.out.println(e.getClass());
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement