Leonardo doesn't talk to serial monitor

The example code for the Leonardo serial port requires you to wait, for example:

 //Initialize serial and wait for port to open:
  Serial.begin(9600); 
  while (!Serial)  { }

Add in the line after Serial.begin and it should work better.