what are the benefits of BufferedReader over Scanner

前端 未结 3 457
清酒与你
清酒与你 2021-01-14 21:20

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 privileg

3条回答
  •  终归单人心
    2021-01-14 21:55

    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

提交回复
热议问题