Capgemini interview question

Basic java, reasoning questions