자바의 클래스를 뚫어보자

2012. 10. 23. 23:30Java/Java API

 

 

FileDump

코딩 소스

 


 

 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package math;
import java.io.*
;public class ReaderExample1 {
    public static void main(String S[])
    {
        FileReader reader = null;
        try{
            reader = new FileReader("poem.txt");
            while(true)
            {
                int data = reader.read();
                if(data == -1){
                    break;
                }
                char ch = (char) data;
                System.out.print(ch);
            }
        }
        catch(FileNotFoundException fnfe){
            System.out.println("파일이 존재하지 않습니다.");
        }
        catch(IOException e){
            System.out.println("파일을 읽을 수 없습니다.");
        }
        finally{
            try{
                reader.close();    
            }
            catch(Exception e){
                
            }
        }
    }
}
 

이런형식으로 할수 있는것을 알수 있었다.

 

하지만 클래스로는 부족하다!