Java 实例 - 文件写入
Java 教程
· 2019-02-10 19:56:49
以下实例演示了使用 write() 方法向文件写入内容:
实例
/*
author by codercto.com
Main.java
*/
import java.io.*;
public class Main {
public static void main(String[] args) {
try {
BufferedWriter out = new BufferedWriter(new FileWriter("codercto.txt"));
out.write("码农教程");
out.close();
System.out.println("文件创建成功!");
} catch (IOException e) {
}
}
}
以上代码运行输出结果为:
文件创建成功!
创建成功后当前目录下就会生成一个名为 codercto.txt 的文件并将 "码农教程" 字符串写入该文件。
点击查看所有 Java 教程 文章: https://www.codercto.com/courses/l/12.html
The Shallows
Nicholas Carr / W. W. Norton & Company / 2010-6-15 / USD 26.95
"Is Google making us stupid?" When Nicholas Carr posed that question, in a celebrated Atlantic Monthly cover story, he tapped into a well of anxiety about how the Internet is changing us. He also crys......一起来看看 《The Shallows》 这本书的介绍吧!