Campbell Ritchie wrote:Very briefly:
First suggestion: use the simplest you can. So Scanner is simpler to code than Buffering.
I agree with the suggestion, but the conclusion is subjective, and I happen to hold the opposing view. :-)
I can't stand Scanner. I never, ever use it, and every time I try to answer questions on it, I have to spend so much time in the Javadocs and playing with sample code that I wonder why anybody would want to get within a mile of it. But that's just my opinion. :-)
So, Chander, what you can take from this is that often there's not one "best" or even "simplest" way to do things. So use the approach that does meets your requirements in the manner that you personally find the simplest or easiest to understand (subject to any rules, conventions, or standards of your team, of course).