接收键盘输入的字符串,用FileWirter类将字符串写入文件,用FileReader类读出文件内容显示在屏幕上

 public class SY63 {
public static void main(String[] args) throws Exception {
System.out.print("请输入字符串:");
Scanner in = new Scanner(System.in);
String st = in.nextLine(); FileWriter fw = new FileWriter("d:\\test.txt");
fw.write(st);
fw.close(); FileReader fr = new FileReader("d:\\test.txt");
char[] bchar= new char[1024];
int len = 0;
while((len = fr.read(bchar)) != -1){
System.out.print(new String(bchar,0,len));
}
fr.close();
}
}
上一篇:Django将.csv文件(excel文件)显示到网页上


下一篇:DG_Oracle DataGuard作用和概念(概念)