Advertisement
DeagleM

Untitled

May 12th, 2021
590
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. public class Main {
  2.  
  3.     public static void main(String[] args) {
  4.     Integer x = null;
  5.     int liczba;
  6.         try {
  7.             liczba = 10 / 0;
  8.         }catch (ArithmeticException e) {
  9.                 System.out.println("Nieprawidłowa operacja arytmetyczna");
  10.                 System.out.println(e);
  11.         }
  12.         try{
  13.             x/=2;
  14.         }catch (NullPointerException e){
  15.                 System.out.println("Niezainicjowana zmienna");
  16.                 System.out.println(e);
  17.         } catch(Exception e){
  18.             System.out.println("Błąd ogólny");
  19.             System.out.println(e);
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement