Answer the question
In order to leave comments, you need to log in
(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
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.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question