package com.lovecoding.day13.exception01;

import org.junit.Test;

import java.io.FileInputStream;
import java.io.FileNotFoundException;

public class Test01 {

    @Test
    public void f01(){
        //递归 f01();
    }

    @Test
    public void f02(){
        //new 对象
        Test01[] arr = new Test01[1000000000];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = new Test01();
        }
    }

    @Test
    public void f03(){
        //数组越界
        int[] arr = new int[2];

        System.out.println(arr[3]);
    }

    @Test
    public void f04(){
        //空指针
        int[] arr = new int[2];
        arr = null;
        System.out.println(arr[0]);
    }

    @Test
    public void f05() throws FileNotFoundException {
        //try catch 自己解决问题
        try {
            FileInputStream fis = new FileInputStream("a.txt");
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }

        //向上抛出
        FileInputStream fis = new FileInputStream("a.txt");

    }

}
