Infosys interview question

basic java and 1 coding question.