Guest User

Untitled

a guest
Jun 24th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. package com.javarush.test.level09.lesson11.home01;
  2.  
  3. /*
  4. Написать метод, в котором происходит деление на ноль. Обернуть его вызов в try..catch.
  5. */
  6.  
  7. public class Solution {
  8.  
  9. public static void main(String[] args) {
  10. divisionByZero();
  11. }
  12.  
  13. public static void divisionByZero()
  14. {
  15. try
  16. {
  17. int someNumbers = 8;
  18. int zero = 0;
  19. int errorDivide = someNumbers/zero;
  20. }catch (ArithmeticException exception){
  21. exception.printStackTrace();
  22. }
  23. }
  24. }
Add Comment
Please, Sign In to add comment