How to invoke an action on keystroke or key binding
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/9075769/how-to-listen-to-keyboard-events-in-a-console-application">How to listen to keyboard events in a console application</a>  </p>
</blockquote>



<p>Hi I am new to java syntax.I am trying to invoke an action on a keystroke like "ENTER key"</p>

<p>For ex:</p>

<pre><code>on pressing Enter key {
    int c = 9+8 ;    //This should run on pressing enter key but not just running program directly
    printf("c");
}
</code></pre>

<p>I have referred few java doc relating to this and tried to execute the code.But I face few syntax errors. Can any one give direct example</p>
