package com.codegym.task.task09.task0918; /* We're all friends here, even the exceptions */ import java.io.*; public class Solution { public static void main(String[] args) { } static class MyException extends Exception { public void test(){ try{ int a=10; int b=0; int c=a/b; } catch(ArithmeticException e){ } } } static class MyException2 extends Exception { public void test1(){ try{ String arr[]={"1","2","3"}; String s=arr[4]; }catch(ArrayIndexOutOfBoundsException e1){ } } } static class MyException3 extends Exception{ public static void method1() throws FileNotFoundException { //Throws FileNotFoundException if the file doesn't exist FileInputStream fis = new FileInputStream("C2:\badFileName.txt"); } } static class MyException4 extends Exception { public void test3() throws IOException { FileInputStream fis = null; fis = new FileInputStream("B:/myfile.txt"); int k; while(( k = fis.read() ) != -1) { System.out.print((char)k); } fis.close(); } } }