Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to system.out when you are currently using a system.in  RSS feed

 
mark goking
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi. would like some ideas how to be able to system.out while the program is currently waiting for any input keys in the system.in

while the program can successfully run other code based on keyboard inputs to system.in, there are threaded programs running in the background that will do system.out

once this happens, the system.out message won't appear until i press some keys in the console.. why is this? would like to ask for ideas how to go about this as well.. thanks

 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't without using multiple threads. Like you said, reading from System.in is blocking, so the only way to do something while it's blocked is to do it in a different thread.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!