Rasmus B. Nielsen said:
Can any tell me how/if I can do something like (in C) kbhit, in
the console?
You can't with pure Java, and you shouldn't.
kbhit is not a standard C function but some operating system specific
extension. It's principle model is based on wasting CPU cycles in loops
like
while(!kbhit()) {
;
}
This is desastrous on any timesharing operating system and should be
avoided at all cost. Java doesn't have any equivalent, and Java is in
general very weak when it comes to deal with the console.
You can create a GUI doing this things but in a more efficient way. You
subscribe to keyboard events, and whenever a key is pressed, your code
is called. When no key is pressed, the VM and the OS can do other
important things instead of burning CPU cycles.