Menu
Question Index
...

What will be the output of the following program?

import java.io.*;
public class BufferedReaderDemo {
    public static void main(String[] args) throws Exception {
        String s = "NUMBER";
        try {
            StringReader sr = new StringReader(s);
            BufferedReader br = new BufferedReader(sr);
            System.out.print((char) br.read() + ", ");
            br.mark(0);
            System.out.println((char) br.read());
            br.reset();
            System.out.println((char) br.read());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}


N, U
M
N, U
U
N, U
N
Compilation Error
Runtime Error

Doubts

Problems

Topic: BufferedReader In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App