Although in the Processing API it is mentioned that key returns the value of the pressed key, but when it comes to arrows it just returns question mark !!! The magic is to use keyCode :-)
void keyPressed(){
//print(keyCode);
if (keyCode == RIGHT){
//GO RIGHT
}
else if (keyCode == LEFT){
//GO LEFT
}