Infosys interview question

Question was on Java programming