wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes When does Java allow console input? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "When does Java allow console input?" Watch "When does Java allow console input?" New topic
Author

When does Java allow console input?

Ryan Smith
Ranch Hand

Joined: Jun 29, 2004
Posts: 40
Here's my code:


First, what triggers a "pause" in program execution?
Secondly, is my code alright?

Thanks so much.

[ June 29, 2004: Message edited by: Ryan Smith ]
[ June 29, 2004: Message edited by: Ryan Smith ]
Sandeep Jindal
Ranch Hand

Joined: Aug 25, 2003
Posts: 180
Dear Ryan,

I have seen your code. You are using a class EasyReader for getting the input from console. You have not send this file. If this file is working as per your requiremnts, your code is working fine.

Answer to your first question, to pause a program execution/getting input from console, we have make instance of input stream reader passing System.in to get input from console.

Hope this will clear your doubt.

Sandeep


SCJP 5.0
http://sites.google.com/site/duddlutechnologies/home
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
This code might be helpful for to learn about the I/O... Make sure you understand the concept of I/O technique...



Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
Ryan Smith
Ranch Hand

Joined: Jun 29, 2004
Posts: 40
Hey guys, thanks so much...that worked!! But, I'm kind of curious now how IO streams work...I didn't quite follow. First, you create an instance of an InputStreamReader, which takes System.in as an argument - does this just create an InputStreamReader that reads console input?

Then, you pass the isr to the BufferedReader - is the bufferedReader just a way of storing isr's data?

That is all a guess, so please correct me...

On a side note, is anyone here studying from a Java book...I'm using JAVA Methods, which is a little on the toned-down side. Kind of slow...

Thanks again guys!
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Yes, Ryan, what you understand is correct... I'm glad to hear that your problem is solved and don't forget to help others as well...
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: When does Java allow console input?
 
Similar Threads
Can somebody please help me with my program?
How do I use a (boolean?) token to reject user input?
[Easy] Shift String
Trying to figure out what those mean
Currency Problem + General Advice