I expected to see it on my screen of course, for example it types "qwerty" in notepad. But I just managed to fix my problem. I already tried KeyPress/Release before but now I keep it pressed for a small amount of time. That did the trick.
package MyProject;
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent;
public class KeyStroke {
public static void main(String[] args) throws AWTException {
Robot robot = new Robot();
robot.delay(3000);
robot.keyPress(KeyEvent.VK_1);
robot.delay(100);
robot.keyRelease(KeyEvent.VK_1);
robot.delay(100);
robot.keyPress(KeyEvent.VK_2);
robot.delay(100);
robot.keyRelease(KeyEvent.VK_2);
}
}