package com.java1.day19;
import java.io.IOException;
public class Test {
public static void main(String[] args) {
try {
System.out.println(readString());
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
}
public static String readString() throws IOException { //throw가 있으면 호출한 쪽에서 예외를 처리해야한다.
byte[] buf = new byte[100];
System.out.println("문자열을 입력하시오: ");
System.in.read(buf);
return new String(buf);
}
}
//에러 난 쪽을 확인하면 surround, IOException 두 가지 방법이 있음.