import java.io.*;

public class A{
public static void main(String [] args) throws Exception{

File f = new File("gg.txt");
FileReader fr = new FileReader(f);
char [] fc = new char [(int)f.length()];
fr.read(fc);
fr.close();

String s = new String(fc);
System.out.print(s);
}
}

 

// FileReader 找不到檔案會出錯,並不會建立新檔

// FileWriter 找不到檔案會幫我們建立新檔

arrow
arrow
    全站熱搜

    黃彥霖 發表在 痞客邦 留言(0) 人氣()