Infosys Interview Question

Oops concept, java