Infosys interview question

Oops concept, java