Advertisement
Voldemord

throwException

Mar 21st, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1. package javaapplication1;
  2.  
  3. public class JavaApplication1 {
  4.  
  5.     public static void main(String[] args) {
  6.         try{
  7.             warunki n = new warunki();
  8.             n.WywalBlad(7);
  9.             System.out.println("Nie znalazłem błędu");
  10.         }catch (Exception e){
  11.             System.out.println("Znalazlem Bląd");
  12.             e.printStackTrace(System.out);
  13.         }
  14.     }
  15.    
  16. }
  17.  
  18.  
  19.  
  20. //------------------------------------------------
  21.  
  22.  
  23. package javaapplication1;
  24.  
  25. public class warunki {
  26.    
  27.     public void WywalBlad(int a) throws Exception{
  28.         if(a==2) throw new Exception("Wykryto liczbe 2");
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement