Is it posible 2 arduino's communicating each other?

Hi i have arduino mega and arduino UNO.

is it posible arduino mega can send some data to UNO using rx2/tx2?

for example i want to send from my pc some data to arduino MEGA and then it will send some data to UNO

how this could happen? just connecting rx2 to tx and tx2 to rx? and what about code?

thanks in advance

Yes, that's possible and the connections proposed are correct.

Having them communicate to each other using software is exactly the same as if you communicated directly to the PC.

The only difference is using Serial1."command" to address the second uart of the megaboard instead of plain Serial."command".

Using the next piece of code on the mega for example would make it possible to let the PC communicate with the uno as if... the mega were transparent.

void setup() {
  // initialize both serial ports:
  Serial.begin(9600);
  Serial1.begin(9600);
}

void loop() {
  // read from Uno, send to pc:
  if (Serial1.available()) {
    int unoByte = Serial1.read();
    Serial.print(unoByte, BYTE); 
  }
  // read from pc, send to Uno:
  if(Serial.available()) {
    int pcByte = Serial.read();
    Serial1.print(pcByte, BYTE);
  }
}

Edit.... Rx2 and tx2 as mentioned in you message on the mega are in fact the third uart of the Mega.
Serial2."Command" would be the right one in the code above.
The idea should work though as long as you choose Serial."command", Serial1."command", Serial2."Command" or Serial3."Command" using the right one(s) of the 4 ports available.

just connecting rx2 to tx and tx2 to rx?

No. You also need to connect grounds.

thanks alot.!!