简单输入问题,高手肯定遇到过。
nifly 2005-03-22 11:59:54 我已经写了一段从键盘输入然后写到F.txt这个文件中,但是这个只支持E文字符啊。如下
======================================================
import java.io.*;
public class AccessFile
{
public static void main(String[] args)
{
try{
FileWriter f=new FileWriter("F.txt",true);
DataInputStream x=new DataInputStream(System.in);
String d=x.readLine();
d=d+"\n";
f.write(d);
f.flush();
}
catch(FileNotFoundException e)
{}
catch(IOException e)
{}
}
}
============================================
请问如何才能使用中文输入并能保存到文件中呢?
请写出代码~~非常感谢。