• Post Reply Bookmark Topic Watch Topic
  • New Topic

input handling options  RSS feed

 
Ranch Hand
Posts: 291
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for most of my programs i have been writing i have been creating a scanner object etc

reading an oracle book and its talking about
System.in.read()

is this used often...or am i better off sticking to a scanner object?

 
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jon ninpoja wrote:
is this used often...or am i better off sticking to a scanner object?


Please elaborate "often"? Often enough to need to learn it?  Using the standard input InputStream specifically? Or using InputSteams in general?

Henry
 
Marshal
Posts: 56608
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jon ninpoja wrote:. . . System.in.read() . . . is this used often... . . .
Yes, it is used often, until the user realises what a pain that method is to use and sees sense and uses something different.

I think objects of InputStreamReader and similar classes wrapped in BufferedReader‍s use it to populate their buffers. I hardly ever use anything other than a Scanner for keyboard input, but I use it indirectly, wrapped in a utility class. Pay a visit to the Java™ Tutorials, which shou‍ld explain how those classes work.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!