import java.io.*;public class Ex{
public static void main(String args[]){
File file = new File("\\tmp.txt");
int i;
try {
//清空文件中的所有内容
FileOutputStream testfile = new FileOutputStream(file);
testfile.write(new String("").getBytes());
testfile.close();
//新建写入流
FileWriter fw = new FileWriter(file);
BufferedWriter bw = new BufferedWriter(fw);
bw.write(10);
bw.newLine();
bw.write("张望");
bw.newLine();
bw.close();
}
catch (IOException e1) {
e1.printStackTrace();
} }
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货