- #1
- 2,136
- 2,712
I have seen that in many cases, teachers and authors prefer Scanner to BufferedReader for taking input from the user through keyboard.
I have found two reasons for this:
1. Scanner class manages exceptions implicitly, while for BufferedReader, exceptions have to be handled either by try..catch statements, or by the throws keyword.
2. The statement for Scanner object declaration is shorter than that for BufferedReader.
Is there any other reason why you would prefer one class to the other?
Just for statistics, I'm opening a poll to determine which is preferred the most: Scanner or BufferedReader.
I have found two reasons for this:
1. Scanner class manages exceptions implicitly, while for BufferedReader, exceptions have to be handled either by try..catch statements, or by the throws keyword.
2. The statement for Scanner object declaration is shorter than that for BufferedReader.
Is there any other reason why you would prefer one class to the other?
Just for statistics, I'm opening a poll to determine which is preferred the most: Scanner or BufferedReader.
Last edited: