9v and USB

Is it safe to connect the Arduino Uno to both the computer via USB cable and to plug in a 9v battery? I don't know if it is even useful for something, I just want to know do I have to unplug the battery if I plug in the USB.

Thanks in advance.

Yes it is safe. The arduino switches to the 9V when it appeares and back to USB when it is removed.