Cognizant Interview Question

Java basics