Question 96
When comparing java.io.BufferedWriter to java.io.FileWriter, which 
capability exists as a method in only one of the two? 
A. closing the stream 
B. flushing the stream 
C. writing to the stream 
D. ing a location in the stream 
E. writing a line separator to the stream 
Answer: E 请问D,E选项说的method分别是什么啊?我查了API,没找到!谢谢

解决方案 »

  1.   

    D.两者都没有提供在流中定位的方法
    E.向流中写入一个行分隔符,这个在java.io.BufferedWriter类中有提供这个功能,即是void newLine():写入一个行分隔符。
      

  2.   

    java.io.BufferedWriter有以下几个方法:close(): 关闭此流,但要先刷新它。
    flush(): 刷新该流的缓冲。
    void newLine(): 写入一个行分隔符。 
    write(char[] cbuf, int off, int len):写入字符数组的某一部分。
    write(int c):写入单个字符。
    write(String s, int off, int len):写入字符串的某一部分.java.io.FileWriter有从java.io.OutputStreamWriter继承的方法:close();
    flush();
    write(int c);
    write(char[] cbuf,int off,int len);
    write(String str,int off,int len);
      

  3.   

    A.关闭流的方法,两者都有的
    B.刷新流的方法,二者也皆有
    C.向流中写东西.当然是都可以写东西的啦
    D.两者都没有提供在流中定位的方法
    E.向流中写入一个行分隔符,这个在java.io.BufferedWriter类中有提供这个功能,即是void newLine():写入一个行分隔符。