Capgemini interview question

Coding under core JAVA basic