/
GermanezZ
/
JavaExercises
Обзор
Документация
Войти
/
GermanezZ
/
JavaExercises
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
AllMetanitLessons/Exeptions/DoubleExeptions.java
42 строки
871 B
germa
Уроки по Metanit
04 дек 2024, 20:39
04 дек 2024, 20:39
48d575a
Код
Авторство
О чём код?
package AllMetanitLessons.Exeptions; public class DoubleExeptions { public static void main(String[] args) { try { SecondExe.Methood(); }catch (ArrayIndexOutOfBoundsException exs){ System.out.println("Критическая ошибка"); } } } class SecondExe{ public static void Methood(){ int[] arr1 = {1,2,3,4,5,6,7,8,9}; int[] arr2 = {1,0,2,0,3,0}; for (int i = 0;i< arr1.length; i++){ try { System.out.println("Result " + arr1[i] + "/" + arr2[i] + " is " + arr1[i]/arr2[i]); }catch (ArithmeticException ex){ System.out.println("/ on 0 is incorrect!"); }catch (ArrayIndexOutOfBoundsException exs){ System.out.println("No Value"); throw exs; } } } }