看你在什么系统下用什么文本编辑器打开的了。在unix下char(10)就可以换行。在windows下用ultraedit和editplus打开也可以换行,但是用windows的打开要char(13) char(10)才能显示换行。这是文本编辑器显示的问题,而不是你的内容问题。

解决方案 »

  1.   

    你试试FileWriter吧
    流式的写对raw byte实现比较好如image data等
    在SPEC中对characters的写建议用FileWriter
      

  2.   

    windows的记事本,那字符串是不是应该这样写:String source = "Now is the time for all good men"+char(13)+char(10)+
    "to come to the aid of their country"+char(13)+char(10)+"and pay their due taxes.";
      

  3.   

    怎么使能将写入windows 记事本中的字符,换行呢?
      

  4.   

    String source = "Now is the time for all good men\n\r"+
    "to come to the aid of their country\n\r"+
    "and pay their due taxes.";
      

  5.   

    to myhotsun(科科)不行啊,出现了两个小黑块,还是不换行...
      

  6.   

    已经帮你运行:
    import java.io.*;
    class Temp4
    {public static void  main(String[] args)
    {String source = "Now is the time for all good men"+'\n'+
    "to come to the aid of their country"+'\n'+
    "and pay their due taxes.";byte b[] = source.getBytes();
    try{FileOutputStream f0 = new FileOutputStream("d:/file1.txt");
    f0.write(b);
    f0.close();
    }
    catch(FileNotFoundException exp1)
    {System.out.println("file not found");
    System.exit(1);
    }
    catch(IOException exp2)
    {System.out.println("IOException occured");
    System.exit(1);
    }
    }}
      

  7.   

    上面程序中修改一下:
    String source = "Now is the time for all good men\n\r"+'\n'+
    "to come to the aid of their country\n\r"+'\n'+
    "and pay their due taxes.";