+ 1
Y do we have to use exception handling mechanism in BufferedReader Class.. but not in Scanner Class?
4 Respostas
+ 6
https://stackoverflow.com/questions/2231369/scanner-vs-bufferedreader
Says here Scanner hides IOExceptions, while BufferedReader throws them immediately
+ 6
Good Question
+ 2
For ease of use - Scanner wins.. For speed- BufferedReader
+ 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