Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.File;
- import java.io.FileNotFoundException;
- public class Exceptions {
- public void catcher() {
- try {
- podniesArrayIndexOutOfBoundsException();
- podniesFileNotFoundException();
- podniesException();
- }
- catch(ArrayIndexOutOfBoundsException e) {
- System.out.println(e);
- }
- catch(FileNotFoundException e) {
- System.out.println(e);
- }
- catch(Exception e) {
- System.out.println(e);
- }
- }
- public void podniesArrayIndexOutOfBoundsException() {
- throw new ArrayIndexOutOfBoundsException();
- }
- public void podniesFileNotFoundException() throws FileNotFoundException {
- throw new FileNotFoundException();
- }
- public void podniesException() throws Exception {
- throw new Exception("zła jednostka");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement