+ 1

Y do we have to use exception handling mechanism in BufferedReader Class.. but not in Scanner Class?

4th Jul 2017, 8:46 AM
suryapoojary
suryapoojary - avatar
4 odpowiedzi
+ 6
https://stackoverflow.com/questions/2231369/scanner-vs-bufferedreader Says here Scanner hides IOExceptions, while BufferedReader throws them immediately
4th Jul 2017, 9:42 AM
jay
jay - avatar
+ 6
Good Question
4th Jul 2017, 9:38 AM
jay
jay - avatar
+ 2
For ease of use - Scanner wins.. For speed- BufferedReader
4th Jul 2017, 9:47 AM
suryapoojary
suryapoojary - avatar
+ 2
basically scanner class takes input in form of tokens and buffered reader reads the input whole as a stream.. here token is a series of characters which ends with a delimiter either whitespace end of file or null.. so when u ask user to input data, the data is rendered by every token and waits for a delimiter.. so the exception may or may not occur .. but in buffered reader the input is read in a stream of line then the exception may occur, if there is a whitespace or endoffile at the beginning itself.. so it needs to throw Exception.. source:Google
4th Jul 2017, 9:53 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar