In java I have a program that needs to check continuously if a user is pressing a key. So In psuedocode, somthing like
if (isPressing(\"w\")) { //do somthin
You have to implement KeyListener,take a look here: http://docs.oracle.com/javase/7/docs/api/java/awt/event/KeyListener.html
KeyListener
More details on how to use it: http://docs.oracle.com/javase/tutorial/uiswing/events/keylistener.html