Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Beginning Java and the fly likes system.in.read() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "system.in.read()" Watch "system.in.read()" New topic
Author

system.in.read()

Bron Czimes
Ranch Hand

Joined: May 09, 2004
Posts: 44
hi there
just a quick question. is there an alternative to system.in.read() if you want to read more than one character at a time, say, maybe a few words or something...???
thanks
bron
David Peterson
author
Ranch Hand

Joined: Oct 14, 2001
Posts: 154
You can read line-by-line with a BufferedReader.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Yes. You can wrap the System.in InputStream in a BufferedReader, which will allow you to read a line of text a time.
To begin to form a good understanding for how these fancy Streams and Readers work, I recommend reading the I/O Lesson of Sun's Java Tutorial.
[ May 09, 2004: Message edited by: Dirk Schreckmann ]

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
 
subject: system.in.read()