0

I'm creating a simple stock simulator game for my comp-sci class using java. My problem comes with making stock prices change using a timer. I was able to create a simple system that changed the stock prices every time the user inputs something or does an action, but I cannot figure out how to get a timer to change the prices, say every ten seconds, while still allowing for the user to do stuff (run in the background).

I did some looking around and was able to find multiple programs using sleeps and timers - but I either couldn't figure out how they worked (I'm relatively new to Java) or they did not allow for the user to do stuff while the timer was running. This is why I need it to run in the background.

Could anyone point me towards a resource that lets me do this? If it matters, I'm using the online IDE repl.it. Thanks.

Jared
  • 13
  • 3

0 Answers0