D
D
def neo2016-07-14 18:36:38
Java
def neo, 2016-07-14 18:36:38

(Java) What is the difference between Scanner and BufferedReader(System.in)?

I recently started learning Java. In this language, console input is possible with Scanner and BufferedReader. In both cases, it turns out well, that in one case, that in the other. And it is interesting to know when it is better to use Scanner and when BufferedReader.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
W
Waylesange, 2016-07-14
@defneo2016

Scanner is slow, but it provides a very wide API with a lot of convenient methods, and BufferedReader is faster because it reads part of the input into the buffer, from where it is read in parts faster, that is, the console is accessed less often. This is commonly used in sports programming. But this is far from a complete list of I / O options, many in sports programming even write their own buffered input, although BufferedReader is fine at a first approximation.

S
Sanan Yuzb, 2016-07-14
@Sanan07

Scanner vs BufferedReader

D
def neo, 2016-07-14
@defneo2016

Thank you guys)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question