title: Java - KeyPress(int) does not work properly
body: <p>My code:</p>
  
  <pre><code>import java.awt.Robot;
  import java.awt.event.KeyEvent;
  import java.util.Scanner;
  
  public class main
  {
      public static void main(String[] args) throws Exception
      {       
          Thread.sleep(3000);
  
          int x = 66;
          int y = (int) 'b';
  
          Robot r = new Robot();          
          r.keyPress  (y);
          r.keyRelease(y);
          r.keyPress(x);
          r.keyRelease(x)         
      }
  }
  </code></pre>
  
  <p>What has me really confused is, if the variable is a number, like <code>x = 66</code>, then <code>r.keyPress(x)</code> will output b - which is correct.</p>
  
  <p>But if I have a variable with the character b  and do:</p>
  
  <pre><code>char b = 'b';
  int y = (int) b
  r.keyPress(y)
  </code></pre>
  
  <p>It will output <code>2</code>.</p>
  
  <p><code>System.out.print(y)</code> will output 66. I'm very confused.</p>
  
  <hr>
  
  <p>I've read the posts, now my question is.. how would I go about:
   1. Accept string from user
   2. Type out the string with r.keyPress
  ?</p>