Cognizant Interview Question

Reverse the linked list using java