Connecting 2 Arduino's with each other while programming

Can I connect 2 Arduino's to a PC while programming and connect the ground of the Arduino's? I want to let them communicate with each other but on the schematics of the MEGA I've seen that the gnd of the USB and the general gnd are separated.

Ground is a reference. You need to have a common ground as a reference.

The separated grounds on the Mega appear to actually be connected through a solder jumper.

Thank you, just wanted to be sure before I would blow them up.