Multiple choice

Which method(s) of buffered reader class is/are used to read string from the keyboard?

  1. read()

  2. readline()

  3. write()

  4. both (1) and (3)

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The BufferedReader class in Java provides the readLine() method to read a full line of text from an input stream, such as the keyboard (System.in). The read() method reads a single character, not a string.