Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main {
- public static void main(String[] args)
- throws Exception
- {
- throw new Exception("Przykałdowy mój komentarz błędu");
- }
- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- public class Main {
- public static void main(String[] args)
- //throws Exception
- {
- Example example = new Example();
- double wynik = example.f(10,2);
- System.out.println(wynik);
- wynik = example.f(10, 0);
- System.out.println(wynik);
- }
- public class Example
- {
- public double f(int liczba1, int liczba2)
- {
- if (liczba2 == 0)
- throw new ArithmeticException("Błąd dzielenia przez 0");
- return liczba1/liczba2;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement