티스토리 뷰
import java.io.*; public class _3_2 { public static void main(String[] args) throws IOException{ // 콘솔모드 InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br1 = new BufferedReader(isr); // 파일모드 FileReader fr = new FileReader(new File("ccc.txt")); BufferedReader br2 = new BufferedReader(fr); /////////////////////////////////////////////////////////////// System.out.print("문자열 = "); String str = br1.readLine(); System.out.println(str); System.out.print("숫자 = "); int x = Integer.parseInt(br1.readLine()); System.out.println(x); /////////////////////////////////////////////////////////////// while(true){ String s = br2.readLine(); // 파일의 내용을 한줄씩 읽어들인다. if(s== null) break; System.out.println(s); } } }
'dev > java' 카테고리의 다른 글
JAVA.UTIL.SCANNER로 텍스트 스캔하기 (0) | 2008.09.30 |
---|---|
[16] Scanner 클래스로 입력 (0) | 2008.09.29 |
[16] Text(2바이트) 기반 출력 (0) | 2008.09.29 |
[15] 예외처리 : try - catch - finally (0) | 2008.09.29 |
[15] 예외 발생 시키기 (0) | 2008.09.29 |
공지사항