본문 바로가기

학교 & 학원 이론 수업/네이버 클라우드 AIaaS 개발자 양성 과정

3월 9일 자바 수업 정리 - Exception

try~catch 

throws 

finally 

 

 

NumberFormatException

ArithmeticException

ArrayIndexOutOfBoundsException

InterruptedException

IOException

FileNotFoundException 

 

package study.day0309;

        import java.io.BufferedReader;
        import java.io.IOException;
        import java.io.InputStreamReader;

public class Ex4Exception {

    public static void main(String[] args) throws IOException {
        // TODO Auto-generated method stub
        InputStreamReader isr=null;
        BufferedReader br=null;

        String name="";
        String addr="";

        isr=new InputStreamReader(System.in);
        br=new BufferedReader(isr);

        System.out.println("이름 입력");
        name=br.readLine();

        System.out.println("주소 입력");
        addr=br.readLine();

        System.out.println(name+"님의 주소는 "+addr+"입니다");
    }

}

 

FileReader()

BufferedReader()

readLine()