• Post Reply Bookmark Topic Watch Topic
  • New Topic

Why its not taking input from BufferedReader, whats wrong in it...  RSS feed

 
Manu Batham
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Friends, will you identify why my code is not working correctly, what is the possible error in my code, why it is not reading console input through bufferedreader.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happens when you run the code? Which lines of code are not working how you expect them to work?
 
Manu Batham
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


br.readLine() is not working...
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't simultaneously use a Reader to read from System.in, and call System.in.read() at the same time. I'd advise to use one of the existing libraries for handling command-line input.
 
Manu Batham
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Still the same problem, i changed my code like the below--

 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think it's such a good idea to use a BufferedReader here; try working with the underlying stream directly.
 
Manu Batham
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry to disturb, but i m noob... don't understand that how to work with underlying stream directly, what it means at all, will you give some line of code as example.....
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I mean to just use the methods in System.in, without wrapping any Reader around it.
 
Manu Batham
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!