Tech Mahindra interview question

Mostly focused on core java