Skip to content

Instantly share code, notes, and snippets.

@ZhdanRuslan
Created April 24, 2015 17:35
Show Gist options
  • Save ZhdanRuslan/d67c335536de82121949 to your computer and use it in GitHub Desktop.
Save ZhdanRuslan/d67c335536de82121949 to your computer and use it in GitHub Desktop.
Exception_task_1
package com.javarush.test.level09.lesson06.task01;
/* Исключение при работе с числами
Перехватить исключение (и вывести его на экран), указав его тип, возникающее при выполнении кода:
int a = 42 / 0;
*/
public class Solution
{
public static void main(String[] args) throws Exception
{
try
{
int a = 42/0;
}
catch (ArithmeticException exc){
System.out.println(exc);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment