If you opened a window similar to the console window and could respond to keystroke events, then you could do what you ask, but otherwise, if you just start the program, the program will stop executing and return control to your console therefore he cannot do anything.
But if you are using a scripted version of java, you can write your own shell, and then you can do what you ask, since the shell will not stop running.
But it will probably be outside of your course.
source
share