Skip to content
Advertisement

what are the benefits of BufferedReader over Scanner

here’s a code about depth first search in graphs. who knows why bufferedReader class were used in this code? and why nextInt function not used instead? what is its privilege? is it for speeding up processing? Thanks 🙂

JavaScript

Advertisement

Answer

It’s an issue of how you intend to use the stream. A buffered reader exists for simple and threaded applications. This is due to scanner’s lack of thread safety.

I think you’ll get more on this from this question Scanner vs. BufferedReader

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement