package addTIME;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
public class b {
public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String a="";
try {
for(int i=1;i<=10;i++){
System.out.println("请输入字符"+i+":");
a=a+br.readLine();
}
FileOutputStream fout = new FileOutputStream("D:\\文件名.txt");//创建文件输出流对象fout,同时打开关联文件ceshi.txt,若文件不存在将新建一个
fout.write(a.getBytes());
fout.close();
} catch (IOException e) {
System.out.println("输入错误");
}
}
}
路过
这从网上可以查到的,或找本教材。