title: Java - Loop while keeping another code running
body: <p>I'm not sure how to accomplish this. I want to have a timer which would keep a loop on forever but while that loop is running I want to be able to have a Scanner running and waiting for user input. Basically like a chat. Where the loop would constantly check for any new messages posted but while the loop is running the user can still submit messages.</p>
  
  <p>How can I do this?</p>
  
  <p>Also I dont have a GUI setup yet. This is all running in a simple command prompt (if it matters).</p>