3、[简答题] 【文件的续写和换行输出】 描述:在D盘下,有一c.txt 文件中内容为:HelloWorld 在c.txt文件原内容基础上,添加五句 I love java,而且要实现一句一行操作(注:原文不可覆盖)。 利用字节输出流对象往C盘下c.txt文件输出5句:”i love java”(3. [short answer] [file continuation and line feed output] Description: under disk D, there is a c.txt file. The content is: HelloWorld adds five sentences of I love Java on the basis of the original content of the c.txt file, and realizes the operation of one sentence and one line (Note: the original text cannot be overwritten). Use the byte output stream object to output 5 sentences to the c.txt file under Disk C: “I love Java”)

3、[简答题] 【文件的续写和换行输出】描述:在D盘下,有一c.txt 文件中内容为:HelloWorld在c.txt文件原内容基础上,添加五句 I love java,而且要实现一句一行操作(注:原文不可覆盖)。利用字节输出流对象往C盘下c.txt文件输出5句:”i love java”

package day_09_test;

import java.io.FileOutputStream;
import java.io.IOException;

//3、[简答题] 【文件的续写和换行输出】
//描述:在D盘下,有一c.txt 文件中内容为:HelloWorld
//在c.txt文件原内容基础上,添加五句 I love java,而且要实现一句一行操作(注:原文不可覆盖)。
//利用字节输出流对象往C盘下c.txt文件输出5句:”i love java”
public class Test03 {
    public static void main(String[] args) throws IOException {
        FileOutputStream fileOutputStream = new FileOutputStream("d:\\c.txt",true);
        fileOutputStream.write("\r\n".getBytes());
        fileOutputStream.write("i love java".getBytes());
        fileOutputStream.close();

    }
}
————————

3. [short answer] [file continuation and line feed output] Description: under disk D, there is a c.txt file. The content is: HelloWorld adds five sentences of I love Java on the basis of the original content of the c.txt file, and realizes the operation of one sentence and one line (Note: the original text cannot be overwritten). Use the byte output stream object to output 5 sentences to the c.txt file under Disk C: “I love Java”

package day_09_test;

import java.io.FileOutputStream;
import java.io.IOException;

//3、[简答题] 【文件的续写和换行输出】
//描述:在D盘下,有一c.txt 文件中内容为:HelloWorld
//在c.txt文件原内容基础上,添加五句 I love java,而且要实现一句一行操作(注:原文不可覆盖)。
//利用字节输出流对象往C盘下c.txt文件输出5句:”i love java”
public class Test03 {
    public static void main(String[] args) throws IOException {
        FileOutputStream fileOutputStream = new FileOutputStream("d:\\c.txt",true);
        fileOutputStream.write("\r\n".getBytes());
        fileOutputStream.write("i love java".getBytes());
        fileOutputStream.close();

    }
}