title: How to preserve current console row when other thread is printing
body: <p>Lets say you have 2 threads.</p>
  
  <ul>
  <li>One prints a message, lets say <code>foo</code>, to the console every 5 seconds. <code>System.out.println("foo")</code> <br></li>
  <li>The other reads input from the user. <code>bufferedReader.readLine()</code> <br></li>
  <li>Then lets say you are in the middle of writing when the first thread prints its message. How do i keep the text the text the user is currently typing, while still allowing the first threads message to be printed to the console? </li>
  </ul>
  
  <p><strong>What is happening now:</strong></p>
  
  <p>Typing:</p>
  
  <pre><code>&gt;&gt; foo
  &gt;&gt; foo 
  hello wor
  </code></pre>
  
  <p>Then the first thread prints its message: </p>
  
  <pre><code>&gt;&gt; foo
  &gt;&gt; foo 
  &gt;&gt; hello worfoo
  </code></pre>
  
  <p><strong>What i want to happen:</strong></p>
  
  <p>Typing:</p>
  
  <pre><code>&gt;&gt; foo
  &gt;&gt; foo 
  hello wor
  </code></pre>
  
  <p>Then the first thread prints its message: </p>
  
  <pre><code>&gt;&gt; foo
  &gt;&gt; foo 
  &gt;&gt; foo
  hello wor
  </code></pre>
  
  <p>How would i go about this? </p>
  
  <p>I don't mind if the solution is a hack, this is only a proof of concept.</p>