Multiplexing input/output consoles to one Arduino?

this is not a perfect code, it just works.
by making the enable pin of lcd low you can prevent the key pad from making changes in the display.
the pins being shared are 9,10,11,12.
it requires no extra components.
it displays the key pressed on the keypad on the second line of the lcd display.

#include <LiquidCrystal.h> 
#include <Keypad.h>
const int rs = 8, en = 13, d4 = 12, d5 = 11, d6 = 10, d7 = 9;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'}
};
byte rowPins[ROWS] = {9, 10, 11, 12}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {5, 6, 7}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup() { 
 lcd.begin(16,2); 
 Serial.begin(9600);
 lcd.print("hello world");
}
void loop() { 
digitalWrite(en,LOW);                    //disable the lcd for multiplexing

 char key = keypad.getKey();             //get key press
  if (key != NO_KEY){
    lcd.begin(16,2);                    //begin to type on lcd
    lcd.print("hello world");
    lcd.setCursor(0,1);
lcd.print(key);
delay(200);
  } 

}