本帖最后由 adamjy 于 2014-4-22 12:40 编辑
以下代码为什么不能将字符串写入文件?
- public static void main(String[] args) throws Exception {
- //定义文件.
- File file = new File("e:\\", "test.txt");
- FileWriter fw = new FileWriter(file);
- BufferedWriter bf = new BufferedWriter(fw);
- String a = "test this file.";
- //写入字符串
- bf.write(a, 0, a.length());
-
- }
复制代码 |