You want multi-threading or concurrency
. This isn't the type of process that you can just drop in some code and have it work. The usual practice is to see if you can simply create a thread, and once you do that, see if you can start and stop a thread, and then see if you can do something with a thread. I linked you to the Sun tutorial on concurrency that you will need, at a minimum, to understand.