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 找不到檔案會幫我們建立新檔

文章標籤
全站熱搜
創作者介紹
創作者 黃彥霖 的頭像
黃彥霖

彥霖 實驗筆記

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