import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
public class Test {
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();
}
File f=new File("D:\\文件.txt");
FileWriter fw=new FileWriter(f);
BufferedWriter bf=new BufferedWriter(fw);
bf.write(a);
bf.close();
System.out.println("文件长度为:"+f.length());
} catch (IOException e) {
System.out.println("输入错误");
}
}
}
这回行吗?