用FileReader就可以啊,它读取的是Unicode字符

解决方案 »

  1.   

    try{
    RandomAccessFile rf=new RandomAccessFile("e:\\my.txt","rw");
    String str="中文";
    byte [] b;
    b=str.getBytes();
    rf.write(b);//中文就写入文本文件了。
    }
    catch(Exception e){}try{ 
    BufferedReader br=new BufferedReader(new FileReader("e:\\my.txt"));
    while((line=br.readLine())!=null)
    {
      System.out.println(line);//读取文件
    }}
    catch(Exception e){}
      

  2.   

    写中文的话用FileWriter,若要写格式化的文本可以用PrintWriter类
      

  3.   

    try{
    RandomAccessFile rf=new RandomAccessFile("e:\\my.txt","rw");
    String str="中文";
    byte [] b;
    b=str.getBytes();
    rf.write(b);//中文就写入文本文件了。
    }
    catch(Exception e){}try{ 
    BufferedReader br=new BufferedReader(new FileReader("e:\\my.txt"));
    String line;//漏了一句
    while((line=br.readLine())!=null)
    {
      System.out.println(line);//读取文件
    }}
    catch(Exception e){}
      

  4.   

    我是在GUI中实现的,它不能保存,英文是可以生成文件的,如何有中文,则不能保存成功,而且程序出现错误,啥原因呀?