• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

When does Java allow console input?

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This code might be helpful for to learn about the I/O... Make sure you understand the concept of I/O technique...

 
Ryan Smith
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic