Created
December 4, 2015 11:37
-
-
Save ProZhar/51a8c8b85e0632a7c4a8 to your computer and use it in GitHub Desktop.
com.javarush.test.level09.lesson11.home01
This file contains hidden or 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.lesson11.home01; | |
| /* Деление на ноль | |
| Создай метод public static void divisionByZero, в котором подели любое число на ноль и выведи на экран результат деления. | |
| Оберни вызов метода divisionByZero в try..catch. Выведи стек-трейс исключения используя метод exception.printStackTrace() | |
| */ | |
| public class Solution { | |
| public static void main(String[] args) { | |
| try | |
| { | |
| divisionByZero(); | |
| } | |
| catch (Exception e) | |
| { | |
| e.printStackTrace(); | |
| } | |
| } | |
| public static void divisionByZero() | |
| { | |
| System.out.println(10/0); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment