日期:2014-05-20 浏览次数:20843 次
import java.io.*;
public class T12{
public static void main(String[] args) throws Exception{
File fDir = new File("D:\\java\\");
if(!fDir.exists()){
fDir.mkdirs();
}
File f=new File(fDir,"123.txt");
if(!f.exists()){
f.createNewFile();
}
String[] str=new String[10];
for(int i=0;i<10;i++){
FileWriter fw=new FileWriter(f);
BufferedWriter bw=new BufferedWriter(fw);
InputStreamReader isr=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(isr);
str[i]=br.readLine();
bw.write(str[i]);
bw.newLine();
bw.flush();
bw.close();
fw.close();
}
}
}