This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

streams

 
nitiish chinnaraju
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


in the above example the loop is not ending i dont know why? please tell me
 
Scott Winterbourne
Ranch Hand
Posts: 116
2
Eclipse IDE Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nitiish,

Please put your code samples inside of [ code ] tags. It will make it much easier for everybody to read your code sample.
 
Paul Clapham
Sheriff
Pie
Posts: 20945
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're reading characters from System.in, i.e. the console, and continue to read until you reach the end of the stream. But when would you expect to reach the end of the stream of data coming from the console?
 
Tony Docherty
Bartender
Posts: 2952
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nitiish,

In future please do as Scott has suggested and use code tags when posting code. Also make sure your code is properly formatted, I've added code tags to your post for you but because your code isn't formatted sensibly it's still really hard to read.

See how much easier the following is to read:
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:You're reading characters from System.in, i.e. the console, and continue to read until you reach the end of the stream. But when would you expect to reach the end of the stream of data coming from the console?

In the good old DOS there was the End-of-file control character (Ctrl-Z). Perhaps this would work in Java too?
 
Paul Clapham
Sheriff
Pie
Posts: 20945
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps it would; I knew about that too (it was Ctrl-D in some other shells which I used a long time ago), but it might not be the best solution to the OP's problem.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic