package itat;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class Example10_7 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
File file=new File("Student.txt");
String content[]={"你好:","近来工作忙吗?","常联系","祝好"};
try {
FileWriter outone=new FileWriter(file);
BufferedWriter outTwo=new BufferedWriter(outone);
for(int k=0;k<content.length;k++){
outTwo.write(content[k]);
outTwo.newLine();
}
outTwo.close();
outone.close();
FileReader inOne=new FileReader(file);
BufferedReader inTwo=new BufferedReader(inOne);
String s=null;
int i=0;
while((s=inTwo.readLine())!=null){
i++;
System.out.println("第"+i+"行:"+s);
}
inOne.close();
inTwo.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}