Frage im Vorstellungsgespräch bei Cognizant

Core java, spring framework,basic coding question to test the logic