Infosys Interview Question

basic question on c++ and java