Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package wyjatki;
- public class Wyjatki {
- void wypiszDlugosc(int liczba) throws NullPointerException {
- //System.out.println(s);
- }
- public static void main(String[] args) throws Exception {
- int liczba;
- Wyjatki z = new Wyjatki();
- try {
- z.liczba(-10);
- }
- catch (Exception e) {
- if (liczba < 0){ throw new NowyWyjatek("NowyWyjatek test");
- }else System.out.println(s);
- throw new NowyWyjatek("Nowy Wyjątek");
- }
- }
- }
- /////////////////////////////////////////////////////////////////////////////////
- package wyjatki;
- class NowyWyjatek extends Exception {
- public NowyWyjatek() {
- super();
- }
- public NowyWyjatek(String message) {
- super(message);
- }
- public NowyWyjatek(Throwable cause) {
- super(cause);
- }
- public NowyWyjatek(String message, Throwable cause) {
- super(message, cause);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement