arduino mega 2560 not working properly

i run this code to check the output. This output comes continuously "" when i connect the pin 7 to 5v and nothing happens when connected to pin 9 on mega2560.

void setup()
{
  Serial.begin(9600);
  pinMode(9,OUTPUT);
  pinMode(7,INPUT);
  Serial1.begin(9600);
  
}
void loop()
{
  digitalWrite(9,HIGH);
  Serial.write(digitalRead(7));
  delay(100);
}