Did you try to load it with Blink (an Example sketch that is in you IDE under File->Examples in section 1) because the load process -does- interrupt the sketch.
Does the compiler make anything of an empty sketch? It optimizes unused variables and code out, maybe you got an error?
Newly bootloaded AVR's get a copy of Blink so you can see that the chip is operating.
Final question is what board you have? It must have the 32u4 chip or a SAMD chip. That is Arduino Micro or Leonardo or Due and a number of compatibles like the Teensy boards.
Reference > Language > Functions > Usb > Keyboard
Keyboard
[USB]
DescriptionThe keyboard functions enable 32u4 or SAMD micro based boards to send keystrokes to an attached computer through their micro’s native USB port.
If you don't have one of those boards, you can connect a PS2 keyboard (and/or mouse or other PS2 device) to any Arduino (that I know of) through the pins.
Arduino Playground - HomePage ---- the simplest
Arduino Playground - HomePage ---- the next level