Menu
Question Index
...

What will be the output of the following program?

import java.io.*;

public class TextFile {
    public static void main(String str[]) {
        try {
            FileWriter fw = new FileWriter("filereadwrite.txt");
            BufferedWriter bw = new BufferedWriter(fw);
            bw.write("have a good day");
            bw.close();
            FileReader fr = new FileReader("filereadwrite.txt");
            BufferedReader br = new BufferedReader(fr);
            br.read();
            br.read();
            br.skip(8);
            System.out.println((char) br.read());
            System.out.println(br.read());
            br.close();
        } catch (IOException e) {
            System.out.println("IOException : " + e.toString());
        }
    }
}


o
8
d
32
g
7
Some other output
Compilation Error or Runtime Error

Doubts

Problems

Topic: Java BufferedWriter

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App