Cognizant interview question

Java basics