No output to serial monitor

I tried a very basic sketch but nothing is output to the serial monitor. This is in the IDE. Any idea.

Serial.begin(9600);
Serial.println("test");

Please post the complete sketch.

The bare minimum sketch can be found in your IDE here:

IDE >> EXAMPLES >> 01. BASICS >> BARE MINIMUM

And here:
https://docs.arduino.cc/built-in-examples/basics/BareMinimum/

Try to add "while (!Serial);" after "Serial.begin(9600);"
Also make sure the baudrate on the serial monitor is set to 9600

regards
Paul

#include <ArduinoBLE.h>
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
while (!Serial)
;

// begin initialization
if (!BLE.begin()) {
Serial.println("starting Bluetooth® Low Energy module failed!");

while (1)
  ;
Serial.println("Bluetooth® Low Energy Central - Peripheral Explorer");

// start scanning for peripherals
BLE.scan();

}
}

void loop() {
}

What is this code ?

If you put "while(1);" with the semi-colon right after, it will loop for ever and nothing will happen. !

Next to that it is inside a check that BLE.begin() failed??

I found the issue. I was using the IDE and the Arduino create agent was running. I closed the agent and serial started to work.