I just encountered a problem concerning the Scanner(System.in) and threads in Java.
Suppose you have two threads. In both you wait for an user input using the Scanner to read from the System.in input stream. The Problem is that it is not possible to differentiate which string belongs to which thread (the chars will be spread between both strings seemingly random). I suppose this is because the two threads share the same input stream.
Is there a way to work around this issue?
See Question&Answers more detail:os