• Post Reply Bookmark Topic Watch Topic
  • New Topic

I'm a little confused about BufferedReader, InputStreamReader, Scanner.  RSS feed

 
Phillip Larson
Ranch Hand
Posts: 31
Android Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Everyone,
I'm a little bit confused about on how to use these Import in java.

Are all three use to get user input? Which one is these Import is the best way to be able to get user input? What is the difference between all three?
If someone can please point me in the right direction that would be great. Thank for the help
 
Paul Clapham
Sheriff
Posts: 22835
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, all of those classes could be used to get user input. As for which of them is the best... the answer to "Which is the best X?" in programming is almost always "It depends".

Anyway you're asking a big question there. In real-life programs there's a lot of input beyond "Enter an integer", so there's a lot of different ways to do those many things. So instead of me spending a lot of time writing up a second-rate explanation of those classes, let me just point you to the Oracle tutorial: Lesson: Basic I/O. That page looks massive but for now you're only interested in the "I/O Streams" section.
 
Phillip Larson
Ranch Hand
Posts: 31
Android Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the help, I'm going to look at the page right now.
 
Stuart A. Burkett
Ranch Hand
Posts: 679
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And a bit of history - an inputstream wrapped in a BufferedReader used to be the 'standard' way of getting user input. Scanner was introduced in Java 1.5, presumably to make getting input easier or more intuitive.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!