Home > Enterprise >  How can I run my code during waiting user input in JAVA
How can I run my code during waiting user input in JAVA

Time:12-26

I am making a game in JAVA console. I want to show elapsed time ,waiting input from user.But I can't run any code waiting input. How can ı run my codes during input wait?

CodePudding user response:

You can create new Thread, define what it should do and start it.

Docs:

https://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html

Check docs for java version you need. These are for version 7.

Also I suggest you to get some knowledge about parallel programming and using threads. There are plenty of material on the internet

  • Related