Cognizant interview question

About java basics and some logical questions